develooper Front page | perl.perl6.language | Postings from April 2001

Re: Larry's Apocalypse 1

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
April 6, 2001 13:23
Subject:
Re: Larry's Apocalypse 1
Message ID:
5.0.2.1.0.20010406161942.01ebf070@24.8.96.48
At 11:17 AM 4/6/2001 -0700, Larry Wall wrote:
>Randal L. Schwartz writes:
>: >>>>> "Nathan" == Nathan Wiger <nate@west.sun.com> writes:
>:
>: Nathan> This is interesting, and in my gut I like it. Many people I've 
>worked
>: Nathan> with end up writing:
>:
>: Nathan>    @foo[0]
>:
>: Nathan> Which works.
>:
>: "Works", for some odd meaning of the word "works".  Ever try this:
>:
>:         @foo[0] = <STDIN>;
>:
>: and then wonder where all the *rest* of your input went?
>
>It's likely to work better in Perl 6.  To mean what it currently
>means, you'll probably have to write something like:
>
>         @foo[0] := <STDIN>;
>
>The colon here is not functioning merely to make the assignment look
>like Pascal.  It means, in this case, the following operator is
>intended to work on arrays, not scalars.  Hence, :+ would be pairwise
>array addition.

This is, I presume, in addition to any sort of inherent DWIMmery? I don't 
see any reason that:

    @foo[1,2] = <STDIN>;

shouldn't read just two lines from that filehandle, for example, nor why

    @bar = @foo * 12;

shouldn't assign to @bar all the elements of @foo multiplied by 12. (Though 
others might, of course)


					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About