This looks like a bug to me (it used to work):
# cat head5.p6
my @x = ( 'a1', 'a2', 'a3' );
say(@x[0..2]);
# pugs head5.p6
a3
The next one illustrates a difference in slice semantics between p5 and
pugs when slicing more elements than are in the array:
# cat lev6.p6
my @z = (
'a1', 'a2', 'a3',
'b1', 'b2', 'b3'
);
my @y = @z[0..6];
for (@y) { print "'$_'\n" }
# perl lev6.p6
'a1'
'a2'
'a3'
'b1'
'b2'
'b3'
''
Notice that p5 puts undef in the last element. Pugs does not do that.
Not sure if p6 is meant to be compatible with p5 in this case though.
BTW, Pugs currently does not accept the parens around (@y) above:
# pugs lev6.p6
''
No compatible subroutine found: &for
App "&for" [] [Var "@y"]
Removing the parens and it is happy:
# cat lev6a.p6
my @z = (
'a1', 'a2', 'a3',
'b1', 'b2', 'b3'
);
my @y = @z[0..6];
for @y { print "'$_'\n" }
# pugs lev6a.p6
'a1'
'a2'
'a3'
'b1'
'b2'
'b3'
This is also a recent change in behaviour; pugs used to be happy
with the parens around @y.
/-\
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
They are. I concluded this week that Pugs's current model of only
having "Const" and "Var" ITypes is ill-fitted with Perl 6 itself,
and we cannot implement the full set of autovivification and tieables
using the old model.
So, today I rewrote all the variable types, symbol tables, and
casting rules, to agree with the Perl 5 model as set forth in
perltie.pod. It's still failing tests, so I've put a SVK patch
at http://autrijus.org/tmp/itype.patch if people are interested
to take a look.
Currently there are six builtin ITypes, each with a set of minimal
implementation:
Scalar: fetch, store
Rule: match
Hash: fetch, store, delete, firstKey, nextKey, isEmpty
Handle: write, read, close
Code: assuming, apply
Array: fetch, store, fetchSize, storeSize
I hope that looks sane, and reasonably close to the Synopses.
%*ENV will then be a instance of Hash IType, binding the various
methods to the actual environment. That also means the "Magic"
interface from Perl 5 can be cleanly replaced with layered ties.
If there are no significant design problems found in the next few
hours, I expect to check it in today after I wake up and fix some
of the casting issues.
Thanks,
/Autrijus/