Re: =$fh vs *$fh
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 signature.asc Description: OpenPGP digital signature
[svn:perl6-synopsis] r8917 - doc/trunk/design/syn
Author: autrijus Date: Sun Apr 23 08:02:50 2006 New Revision: 8917 Modified: doc/trunk/design/syn/S02.pod Log: * S02: The *() form now means *($/). * Clarified that $() etc are term-level macros. Modified: doc/trunk/design/syn/S02.pod == --- doc/trunk/design/syn/S02.pod(original) +++ doc/trunk/design/syn/S02.podSun Apr 23 08:02:50 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall [EMAIL PROTECTED] Date: 10 Aug 2004 - Last Modified: 22 Apr 2006 + Last Modified: 23 Apr 2006 Number: 2 - Version: 29 + Version: 30 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -603,8 +603,9 @@ All prefix sigil operators accept one positional argument, evaluated in scalar context as a rvalue. They can interpolate in strings if called with -parentheses. The C$(), C@() and C%() forms defaults to C$/ as the -implicit argument. +parentheses. The special syntax form C$() translates into C$( $/ ) +to operate on the current match object; the same applies to C@(), C%() and +C*() forms. CCapture objects fill the ecological niche of references in Perl 6. You can think of them as fat references, that is, references that
[svn:perl6-synopsis] r8918 - doc/trunk/design/syn
Author: autrijus Date: Sun Apr 23 09:07:38 2006 New Revision: 8918 Modified: doc/trunk/design/syn/S04.pod Log: * S04: the stop-parsing-on-bare-block rule for conditionals: if -e { say exists } { extra() } has also to stop parsing on pointies: if -e - $x { say exists } { extra() } Modified: doc/trunk/design/syn/S04.pod == --- doc/trunk/design/syn/S04.pod(original) +++ doc/trunk/design/syn/S04.podSun Apr 23 09:07:38 2006 @@ -623,22 +623,25 @@ You can still parenthesize the expression argument for old times' sake, as long as there's a space between the closing paren and the opening brace. You Imust parenthesize the expression if there is -a bare block that would be misinterpreted as the statement's block. -This is regardless of whether a term or operator is expected where -the bare block occurs. (A block inside brackets, or used as as +a bare block or pointy block that would be misinterpreted as the statement's +block. This is regardless of whether a term or operator is expected where +the block occurs. (A block inside brackets, or used as as postcircumfix is fine, though.) Any block with whitespace in front of it will be taken as terminating the conditional, even if the conditional expression could take another argument. Therefore if -e { say exists } { extra() } +if -e - $x { say exists } { extra() } is always parsed as if (-e) { say exists }; { extra() } +if (-e) - $x { say exists }; { extra() } rather than if (-e { say exists }) { extra() } +if (-e (- $x { say exists })) { extra() } Apart from that, it is illegal to use a bare closure where an operator is expected. (Remove the whitespace if you wish it to be
Re: =$fh vs *$fh
Larry Wall skribis 2006-04-22 19:40 (-0700): Hmm, I almost never write scalar FH because I very rarely want to input a single line in list context. But leaving that aside... I've used it a lot. I do tend to use it less often as I move away from line based text documents for storage. [101 lines] I wish I had time to read it all. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html
Re: svn links for the Architecture section on the website?
Given the recent explosion of svn commits in the synopses, and the fact that the versions of the synopses on the dev.perl.org/perl6 site are lagging a bit, would it make sense to add a link to the svn site to the Synopses page? I'd rather not. The ones on the dev site shouldn't have been more than 24 hours out of date. I've updated the cron job so they should now update every 6 hours. -R