On Mon, Mar 07, 2005 at 05:36:08PM +0100, Aldo Calpini wrote:
> David Storrs wrote:
> >Urk. I, for one, will definitely find this surprising.  I would have
> >expected:
> >
> >  x = <whatever>; $y = 1; z = 2 3
> 
> to obtain what you have expected, you need to explicitly treat the array 
> as a list of values with the unary splat:
> 
>     foo($x, [EMAIL PROTECTED]);
>
> >But I suppose it's all a question of learning to love the Brave New
> >World in which arrays are actually objects (sort of).
> 
> more to the point, arrays are automagically referenced in scalar context:
> 
>     @a = @b;  # same as perl5
>     $a = @b;  # means $a = [EMAIL PROTECTED] in perl5
>     $a = [EMAIL PROTECTED]; # means $a = @b in perl5 (more or less)


Yes, I know.  That's what I meant by "...arrays are objects...(sort
of)."  They are objects in the sense that they are sort of references
and sort of not and that they have behavior built into them
(e.g. C<.length>). They won't actually have a class (I don't
think...type Array is not the same as a hypothetical class Array,
right?), but otherwise they quack awfully much like an object.


> another thing that may surprise you (it still surprises me, somehow):
> 
>     sub bar($x, $y, $z) { ... }
>           # ^ note x is scalar here!
> 
>     my @coords = (1.0, 3.0, 5.0);
>     bar(@coords); # wrong
>                   # x => [EMAIL PROTECTED], y => undef, z => undef
> 
>     bar([EMAIL PROTECTED]); # ok


Yep, I am pretty sure that's going to trip me up endlessly for the
first 6 months or so.  


To be perfectly honest, there are steadily more things I don't like
about the way Perl 6 is going, especially when it comes to signatures.
They are excessively verbose, they lead to (what I think is, and what
I suspect most Perl 5 programmers will think is) weird behavior like
that described above, and the type system feels like a straitjacket.
I know all these features are optional, but they WILL be used, which
means I have to know them so that I can maintain other people's code.
Essentially, it feels like we're turning our beautiful language into
something that has all the fun of Java but without Sun's marketing
budget.

 
But, every time I find myself thinking these things I take a deep
breath, put my faith in Larry, and assume that it will work out--I
really do have an amazing degree of faith in his ability to pull off
miracles.  Hopefully, after I have a chance to play with the
production version of P6 for a while, all of these things that
currently seem like effluent will start to see like useful tools.

Fingers crossed,

--Dks

-- 
[EMAIL PROTECTED]

Reply via email to