in reply to Re^5: Strong typing and Type Safety.A multilanguage approach
in thread Strong typing and Type Safety.A multilanguage approach
Sure, I can "explicitly" do 0+ with the intent of converting a string into a number. "Explicit" describes my motivation. But, no, 1+$duration is not an explicit type conversion, it is explicit addition that implies a type conversion, if required.
I can write 1+$duration with no intention of doing a conversion. If I am mistaken in thinking that $duration holds a numeric value and write 1+$duration, since the explicit request for addition includes in it an implicit possibility of type conversion, the compiler can't tell that I didn't mean for a conversion to happen. The type conversion is called "implicit". Having to write 1+(int)$duration is much more explicit. Type conversion is only done when I explicitly say "do a type conversion" not when I say "do addition" and can't separately specify that I want a conversion.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Strong typing and Type Safety.A multilanguage approach (implicit)
by chromatic (Archbishop) on Nov 22, 2010 at 00:12 UTC | |
by ikegami (Patriarch) on Nov 22, 2010 at 01:59 UTC | |
by chromatic (Archbishop) on Nov 22, 2010 at 02:23 UTC | |
by ikegami (Patriarch) on Nov 22, 2010 at 02:44 UTC | |
by chromatic (Archbishop) on Nov 22, 2010 at 04:08 UTC | |
|