Larry Wall wrote:
> On the other hand, -<> makes a pretty pathetic fish operator.  So for
> the sake of argument, let's keep it =<> for the moment.  But ignoring the
> tail leads us to the head end of the fish.  What do we do about $ARGS?
> We could say this:
> 
>     =$fh : *$fh :: =<> : *<>
> 
> Now if you analyze *<> as a unary * plus a null list, it's obviously
> stupid to be interpolating 0 arguments at this point, so pragmatically
> speaking something else is meant by this utterance, and we could make
> it mean "read all the lines of $ARGV" easily enough.

On the other hand, maybe * plus a null list, namely *(), has a higher
purpose, where it can mean *$/, which is very very very useful. To wit:

 grammar Java;
 rule statement {
     | <block>
     { Block.new(*()) }      # Java::Block.new(block => $<block>)

     | if \( $<cond> := <expr> \)          <statement>
         [ else $<else_statement> := <statement> ]?
     { If.new(*()) }

     | for \(
         <init>              ;
         $<cont> := <expr>?  ;
         $<next> := <expr>
       \)
       <statement>
     { For.new(*()) }

     | ...
 }

I think *() above is more visually distinct than *$/.

> (Presumably the @ forms would be for rvalue use only--at least till MJD
> gets ahold of them--but I don't think that's terribly important one way
> or the other in a huffman fight.)

Lvalue @$fh can be fun too indeed, but I guess it depends on how the $fh
is constructed. :-)

> Another option is to just give up on the <> meme.  We just invented the
> Whatever token *, so maybe in an iterator context Whatever means $ARGS.
> Then we get =* as reading a line from $ARGS, and @* perhaps as reading
> all the lines, or @(*) if you're worried about the twigilhood of *.

I think I like this alternative best.  The <> meme never really felt
comfortable to me, as the empty string-list "magic" may be too much magic.

> If we do say that $fh.as(Array) pulls all the lines from the
> iterator destructively (though lazily), then it logically follows
> that $fh.as(Scalar) pulls one line.  Which means instead of
> 
>     say(=$fh, =$fh, =$fh);      # print three lines
> 
> you'd just say
> 
>     say($$fh, $$fh, $$fh);      # print three lines

One problem is that while repeated @$fh conceptually returns the same
thing, $$fh here would iterate instead of merely dereference, which
makes it carry its own state.  If "=" means something like "each(%kv)"
in Perl 5, and we get [EMAIL PROTECTED] as well for iterating over elements, 
then
it makes more sense for that purpose for =$fh as well.

Thanks,
Audrey

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to