Question about: ("1.1").to!int;
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Fri Oct 23 14:52:47 UTC 2020
On Friday, 23 October 2020 at 14:16:50 UTC, user1234 wrote:
> The third case is just like `cast(int) 1.1` it's not _at
> programmer request_ from my point of view
If the programmer explicitly writes a `to!int` or the
`cast(int)`, then it's pretty clearly at their request. And it's
unambiguous what they are asking for.
But if the input to the conversion is a string, it's important
that the conversion fail unless the string is an unambiguous
representation of the intended destination type. Otherwise,
there is more than one data conversion going on, and one of them
is being hidden from the programmer.
More information about the Digitalmars-d-learn