At 07:56 PM 5/4/2001 -0700, Larry Wall wrote:
>Nathan Wiger writes:
>: > : This one. I see a filehandle in *boolean* context meaning "read to $_",
>: > : just like the current "while (<FOO>)" magic we all know and occasionally
>: > : love. I'd expect $FOO.readln (or something less Pascalish) to do an
>: > : explicit readline to a variable other than $_
>: >
>: > It would be $FOO.next, but yes, that's the basic idea.  It's possible
>: > that iterator variables should be more syntactically distinquished than
>: > that.  One could, I suppose, make up something about $<FOO or $<FOO>
>: > meaning the same thing thing as $FOO.next, for people who are homesick
>: > for the angles, but I haven't thought that out, and don't even dare to
>: > mention it here for fear someone will take it as a promise.  Er, oops...
>:
>: So, just to clarify, the thought is:
>:
>:    print while ($FOO);    # like Perl 5 <FOO>
>:    $var = $FOO.next;      # like Perl 5 $var = <FOO>;
>:
>: I assume that this is indicative of a more general iterator syntax, and
>: subject to indirect objects?
>:
>:    $FH = open "<$file" or die "Can't open $file: $!";
>:    $line = next $FH;
>:
>: If so, I can live with that.
>
>Yes, that's the reason it's C<next>, and not something more specific
>like C<readline>, which isn't even true in Perl 5 when $/ is mungled.

I dunno. Color me unconvinced--I do use the <> enough in non-while context 
(and in non-implied while context) to make the whole idea of next feel 
rather... nasty. And $FOO.next? Yuck. Reading lines/records in is one of 
the most fundamental things one can do in a computer language (especially 
perl) and having to jump through OO hoops to do simple things just feels 
like a step in the wrong direction. Conceptual elegance and orthogonality 
are nice enough, but we have enough of those languages. (If I wanted 
Eiffel, I know where to find it)

Or is this a subtle ploy to make sure we ship with a working perl 5 parser? :-P

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to