On Mon, Sep 05, 2011 at 11:03:08AM -0400, aroc...@vex.net wrote:
> 1. Should there be a way to make "die" behave like the Perl 5 version,
> reporting the place of death unless the message is terminated by \n ?
> The \n no longer suppresses the location indormation. I can't find a
> definition either way in the Synopses.

There is not currently such a way.  I would also be interested in one.
Talk to Moritz Lenz, he is heading the current exceptions redesign.

The essential difference from Perl 5 here is that Perl 6 uses a more
Java-like exceptions model, with exception objects and backtraces.

> 2. The following code (c_to_f) is broken: (I subsequently found the
> correct way to loop over the 0..20 values)
> 
> #! /home/guru/bin/perl6
> my $c;
> 
> for $c = 0..20 {
>     say $c;
>     my  $f = ($c * 9 / 5) +32;
>     say $f;
> }
> 
> It produces the following result:
> 
> $ ./c_to_f
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 69.8
> 
> "Say" is clearly treating $c as an array in some way, but the arithmetic
> is using a value of 21 (the number of array elements) in $c. Is there a
> reasonable explanation for what's happening?

$c = 0..20 is just an assignment operator.  The corect syntax is
for 0..20 -> $c { ... }; Perl 6 parsers are expected to catch the Perl 5
syntax (for $c (0..20) { ... }), but what you did is something completely
out of left field.

As a result $c was assigned a single scalar Range object; since the Range
was assigned to a $ variable, it became opaque to 'for' and so the for
loop was treated as a loop over a 1-item degenerate list.  'say' received
the Range object and so did the * operator.

> 3. The following is an edited transcript of a session playing with ...
> (the comment lines inserted afterwards). Are they the intended results?
[snip]

No comment, I don't understand ... much.

> Null PMC access in setprop()
>   in main program body at line 1
> #       Is this message correct?

No, Null PMC access is *always* a bug.

> $ perl6 -e 'say "Yo"; if !{...}  { say "Bye"} '
> Yo
> $ perl6 -e 'say "Yo"; if {...}  { say "Bye"} '
> Yo
> Bye
> #       The opposite to what I'd expect, if ... returns failure

You did not execute ... .   {} is context-sensitive; as the top level
of a statement it's just grouping, but here it constructs an anonymous
function that takes no arguments, and functions are always true.

If you want to do grouping here, use (...) or (do { ... }) (they are the
same, except that the do-form traps lexicals and acts a loop).

> $ perl6 -e 'say "Yo"; say {...} '
> Yo
> _block1063
> #       What is that? The reference to an anonymous subroutine?

Exactly.  As I said, {...} isn't grouping unless it's the entire
statement.

> I would have submitted this through my usual account at GMail, but GMail
> says it "has detected unusual activity on my account", and wants to send
> me a confirmation code on a cellphone.
> A) I don't own a cellphone, and
> B) wouldn't give Google the number if I did.

You submitted this twice under two different names.  Please,
if you want to establish an identity in the Perl 6 community, be
consistent about what names you use where.

-Stefan (sorear on #perl6 IRC)

Attachment: signature.asc
Description: Digital signature

Reply via email to