Hello everyone,

I was toying around with Pugs and I tried the following Perl 5 list assignment

 my ($a, undef, $b) = 1..3;

Which gave me the following error message:

 Internal error while running expression:
 ***
     Unexpected ","
     expecting word character, "\\", ":", "*" or parameter name
     at <interactive> line 1, column 14

I had a quick discussion on #perl6 with TimToady++ during my lunch
hour, and he said that assignment to undef was no longer valid.  His
suggestion was to use the whatever operator (*) instead.

Now, this isn't implemented and my Haskell skills and knowledge of
Pugs' internals aren't really advanced enough to implement this
feature, however I can surely contribute the tests.  Here's what I
have right now in my working copy, let me know if this seems
reasonable.

   my @a = 1..3;
   my ($one, *, $three) = @a;
   is(~($one, $three), "1 3", "list assignment my ($, *, $) = @ works");

   my (*, $two) = @a;
   is($two, 2, "list assignment my (*, $) = @ works");
   my (*, *, $three) = @a;
   is($three, 3, "list assignment my (*, *, $) = @ works");

   my (*, @b) = @a;
   is([EMAIL PROTECTED], "2 3", "list assignment my (*, @) = @ works");

Any input would be very much appreciated (and some links to documents
that could help me contribute to the internals of Pugs),

Vincent.

Reply via email to