[EMAIL PROTECTED] wrote:
[Summary of some of the new Perl 6 constructs]
I have answered your questions and made a few comments.
Apart from these what you wrote is accurate.
Damian
-----cut----------cut----------cut----------cut----------cut-----
> my $x is foo = 0;
> Now $x.foo is equal to 1 (isnt it?), but $x is 0. In fact $x.foo is interpreted as
>method call i.e. $x.foo().
> If there is no method with name foo() then such method is pretended to exist and it
>returns the value of property with that name.
All correct.
>
> $x.btw
>
> will return hash-ref to properties hash i.e. pHash-ref.
It won't be called C<.btw> though. Probably C<.prop> instead.
> So that :
>
> print keys %{$x.btw}
print keys %{$x.prop}
In Perl 6 you can also just say:
print keys $x.prop
since the hash ref returned by C<.prop> will be automatically dereferenced by the hash
context of C<keys>.
> (What "btw" mean --> "By the way" ?)
Yes. Which is too cute. So we've changed that.
> Then what about this :
> @a ^&& @b
Produces a list of (@a[0] && @b[0], @a[1] && @b[1] ...)
>
> @a ^|| @b
Produces a list of (@a[0] || @b[0], @a[1] || @b[1] ...)
> In addition to the standard assignment operator of perl5 "=" we will also have ":="
>i.e. bind operator.
> <snip - apo3>
> If you're familiar with Prolog, you can think of it as a sort of unification
>operator (though without the implicit backtracking semantics). In human terms, it
>treats the left side as a set of formal arguments exactly as if they were in the
>declaration of a function, and binds a set of arguments on the right hand side as
>though they were being passed to a function. This is what the new := operator does.
> </snip>
Another way of thinking of it is that:
$x := $y
makes $x another name for the variable currently known as $y.
> %x := @ary[0]{keylevel1}{keylevel2};
> print %x{keylevel3};
> ? Is this correct ?
Yes.