On Mon, Mar 05, 2007 at 09:22:59AM -0800, Dave Whipp wrote:
: I was wondering about the semantics of coercion of non-numbers, so I 
: experimented with the interactive Pugs on feather:
: 
: pugs> +"42"
: 42.0
: pugs> +"x42"
: 0.0
: 
: I assume that pugs is assuming "no fail" in the interactive environment. 
: However, Is "0.0" the correct answer, or should it be one of "undef", or 
: "NaN"?

It should probably warn by default since warnings are supposed to be on
by default in Perl 6, but if that is supressed the return value should
at least be an interesting value of undef containing the warning that
would have been emitted, so that the warning can be issued later if
the value is actually used.

: In my experiments, I also noticed:
: 
: pugs> my Int $a = "42"
: "42"
: pugs> $a.WHAT
: ::Str
: 
: 
: It seems that the explicit type of $a is being ignored in the 
: assignment. Am I right to assume this is simply a bug?

Well, it's just not implemented, I think.  Or more accurately, still in
the process of being implemented, since the pugsers are madly working on
metaobjects this week.

: testcase (if someone with commit bits can add it):

I'm sending you a commit bit so you can add tests.  It's traditional
to add yourself to AUTHORS as the first checkin to make sure things work.

Larry

Reply via email to