Front page | perl.perl6.language |
Postings from May 2005
May 19, 2005 12:06
Message ID: 428CE39D.firstname.lastname@example.org
> Parens and square brackets are very different things.
I know. The parens relevant here are the ones for precedence overrides.
And Comma is pretty low, so it almost always needs parens around it to
form lists. In particular it is below = and friends.
> The above is more commonly written as
> my @b = ([1,2,[3,4]);
Assuming you meant @b = ([1,2,[3,4]]) what do the parens accomplish
here? Would it even need to be @b = (,[1,2,[3,4]]) to have the list
Does the following hold: @a = (1,2,3); @b = @a; +@b == 1?
My pivot question here is if +[1,2,[3,4]] == +(1,2,[3,4]) == 3 and
why then is @a = [1,2,[3,4]]; +@a == 1 but $a = [1,2,[3,4]]; +$a == 3.
And yes, I know that it is the case in Perl5. Perl6 has automatic deref
and ref---or pretends to do so for people like you and Perl5 legacy.
Otherwise $a = @b in Perl6 weren't the equivalent of Perl5's $a = \@a.
There are no Hash or Array registers in Parrot after all. On the engine
level strings and PMCs are referential in nature but this shouldn't
bother the Perl6 programmer.
Or putting the question different: does &prefix:<+>:(Any $x) get a
different thing for its $x when called with @array = (1,2,3) or
a literal [1,2,3]?
BTW, how does @a = <one two three> compare to $a = <one two three>?
Is +@a == 3?
Is $a == 'two'?
> Having arrayrefs flatten in list context, or having  to be able mean
I don't think they shall flatten. I'm just saying that it might be nice
to let variables with the @ sigil just absorb them as they are.
> something other than constructing an arrayref, is a change that requires
> the very fundaments of Perl to change very heavily, beginning by
> eliminating lists entirely, and using only arrays.
Larry only recently said something to that effect in
To summarize in my words:
1) no List type or class
2) Eager and Lazy sounds more like closures, iterators, generators
3) And Array having a slot for each sounds to me like two private,
scalar attributes that behave like $:eager = [1,2,3] which undeniably
gives +$:eager == 3
> These are mistakes many Perl 5 beginners make, especially those coming
> from Python.
But this is the Perl6 language list, not a Perl5 beginners list.
And I see a lot of things changed from Perl5 to Perl6, including
referential semantics. Until now you haven't convinced me of
the advantages of the old-style Perl5 references. What do they buy us?
TSa (Thomas Sandlaß)