On 2013-05-27 15:45:27, KENTNL wrote:
Show quoted text> imo, the rationale is basically "Num" should indicate "is a number"
> not
> "coerces to a number", and making the distinction means you get more
> rigorous
> code, and coercions, if any, should be performed during assignment to
> the
> attribute, not every time consuming code evaluates the value.
>
> And if you want attribute coercion, it should be explicit, not
> implicit.
I wholeheartedly agree with these points. Which raises the question in my mind:
Should (the new) Num have a coercion defined for Str->Num which uses looks_like_number heuristics to transform to a valid Num (the coercion sub would actually be something like { $_ + 0 }?
I don't think any of the builtins have coercions defined for them, but we could easily add some sensible ones.