Re: Return with no expression

2004-08-20 Thread Matthew Walton
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Aug 2004, at 18:04, Luke Palmer wrote: The one in Perl 5 that stands out most was the cause for the only patch I ever sent to p5p: the rand function. "rand $x" will give you a uniformly distributed random number in [0, $x) for any $x EXCEPT 0. I

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Peter Behroozi
On Thu, 2004-08-19 at 12:17 -0400, Matt Diephouse wrote: > At this point, you may as well use C<.records> (think C<$/> -- record > separator): > >for $foo.records { ... } > > Then it'd be a small step to allow: > >for $foo.records :sep"," { ... } > --or-- >for $foo.r

Re: Synopsis 4 draft 1

2004-08-20 Thread Brent 'Dax' Royal-Gordon
Larry Wall <[EMAIL PROTECTED]> wrote: > Final blocks on statement-level constructs always imply semicolon > precedence afterwards regardless of the position of the closing curly. > Statement-level constructs are distinguished in the grammar by being > declared in the statement syntactic group: > >

Re: Synopsis 4 draft 1

2004-08-20 Thread Aaron Sherman
Larry Wall wrote: =head1 Title Synopsis 4: a Summary of Apocalypse 4 A little light reading is always good in the morning ;-) To return a value from a pointy sub or bare closure, you either just mention the value last that you want to return, or you can use C. A C by default exits from the inne

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread David Green
On 8/19/04, [EMAIL PROTECTED] (Luke Palmer) wrote: >David Green writes: > > Hang on -- should we be saying "for each $foo" or "for $foo.each" > > anyway? We don't say "for @foo.each"; the iteration is implicit. So > > I'm thinking it should be "for $foo" or "while next $foo". > >Well, C gives you

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread David Green
On 8/19/04, [EMAIL PROTECTED] (Larry Wall) wrote: >It's hard to come up with an English word that means "next" in scalar >context but "all" in list context. I never know whether to name my arrays singular or plural, either. =) But couldn't there be Two Ways To Do It? One "singular" name and on

Re: Synopsis 4 draft 1

2004-08-20 Thread Jonathan Scott Duff
On Thu, Aug 19, 2004 at 07:45:37PM -0700, Larry Wall wrote: > BEGIN {...}*at compile time, ASAP > CHECK {...}*at compile time, ALAP >INIT {...}*at run time, ASAP > END {...} at run time, ALAP > FIRST {...}*at first block entry time > ENTER

Re: Synopsis 4 draft 1 -- const block params and placeholders

2004-08-20 Thread Dave Whipp
> Parameters are by default constant within the block. You can > declare a parameter read/write by including the "C" trait. > If you rely on C<$_> as the implicit parameter to a block, then > then C<$_> is considered read/write by default. That is, > the construct: > > for @foo {...} > > is a

Re: Return with no expression

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 09:21:02AM +0100, Matthew Walton wrote: : It would be nice if rand behaved a bit more sanely in Perl 6. I can : understand the reasoning for making rand 0 produce between 0 and 1, but : that doesn't mean I have to like it. What makes you think there was any "reasoning" in

Re: Synopsis 4 draft 1

2004-08-20 Thread Luke Palmer
Aaron Sherman writes: > Larry Wall wrote: > > leave :from(Loop) :labelÂLINEÂ <== 1,2,3; > > [...] > > leave <== :foo:bar:baz(1) if $leaving; > > I know it's probably just me, but This section seems to suddenly rely on > a lot more knowledge of the current state of Perl 6 syntax than I have.

Re: Synopsis 4 draft 1

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 09:18:06AM -0500, Jonathan Scott Duff wrote: : Whither REDO {...} ? Or do we just manufacture that ourselves with : NEXT? Hmm, well, you can view C as just a C in disguise, or as a C that suppresses the "while" check. But I think it's seldom enough used that it doesn't r

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Luke Palmer
David Green writes: > Then I thought that maybe "for" doesn't need to work lazily (except that > the conveniently just-posted Synopsis 4 confirms that it is supposed to > be lazy). Or maybe "for" is only "as lazy as is reasonable", meaning if > it knows how (e.g. if you're using an array or fil

Re: Synopsis 4 draft 1 -- const block params and placeholders

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 09:04:48AM -0700, Dave Whipp wrote: : > Parameters are by default constant within the block. You can : > declare a parameter read/write by including the "C" trait. : > If you rely on C<$_> as the implicit parameter to a block, then : > then C<$_> is considered read/write by

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 10:49:17AM -0600, Luke Palmer wrote: : : method postcircumfix:<> ($self: *%opt) returns List { : scalar $self.<*%opt>, $self.<*%opt> # [1] : } : : [1] Look, Larry, I had to use C! Maybe we _do_ need to revive : $()! It's not clear to me that $() would h

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Larry Wall
On Thu, Aug 19, 2004 at 08:12:37PM -0500, Peter Behroozi wrote: : And to replace $/ we could have something like: : : for $foo.fetch :upto(",") { ... } #or : for $foo.fetch :until(",") { ... } I suppose in <>-ese, that could be one of: for $foo.< :upto(",") > { ... } #or for $foo.< :unti

"<->" as "->" with automatic "is rw"

2004-08-20 Thread Juerd
I like that arguments will be readonly by default. But when I look at my current code, I see that I would be typing " is rw" quite a lot, which in my opinion is too long for a thing that occurs very often. Every such situation in my code is a foreach loop. A thing that in Perl 6 will mostly be use

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 12:52:56PM -0700, Larry Wall wrote: : Unfortunately, the only obvious one, 's', is taken. I remind myself that 'S' is equally obvious, and not taken. Like _, it suffers from spacing issues, but could be the ASCII backup for the § character. (As Y is likely to be the ASCII

Re: "<->" as "->" with automatic "is rw"

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 10:07:02PM +0200, Juerd wrote: : I'm proposing : : for zip(@foos, @bars, @xyzzies) <-> $foo, $bar, $xyzzy { ... } : for %quux.kv <-> $key, $value { ... } That'd probably work on the keys only if the hash was declared to have object keys. At least in Perl 5, the ke

Re: "<->" as "->" with automatic "is rw"

2004-08-20 Thread Matt Diephouse
On Fri, 20 Aug 2004 13:31:12 -0700, Larry Wall <[EMAIL PROTECTED]> wrote: > It's vaguely possible I could be persuaded on the basis that > > for zip @a ¥ @b <-> { ($^a,$^b) = ($^b,$^a) } Shouldn't that be: for zip @a, @b <-> { ... } --or-- for @a ¥ @b <-> { ... } ? --

Re: Synopsis 4 draft 1

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 12:39:35AM -0700, Brent 'Dax' Royal-Gordon wrote: : Larry, you're a genius. Yeah, well, that and 150 cents'll get me a cup of coffee... Larry

Re: "<->" as "->" with automatic "is rw"

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 04:46:33PM -0400, Matt Diephouse wrote: : On Fri, 20 Aug 2004 13:31:12 -0700, Larry Wall <[EMAIL PROTECTED]> wrote: : > It's vaguely possible I could be persuaded on the basis that : > : > for zip @a ¥ @b <-> { ($^a,$^b) = ($^b,$^a) } : : Shouldn't that be: : : fo

Re: "<->" as "->" with automatic "is rw"

2004-08-20 Thread Matt Diephouse
On Fri, 20 Aug 2004 13:49:46 -0700, Larry Wall <[EMAIL PROTECTED]> wrote: > Yes, a typo. Though it's not actually clear yet whether you have to > write zips args with semicolons, which is why I partially switched > to ¥ in midthink. Just checking. I wondered if you'd introduced a new feature midt

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Dan Hursh
Peter Behroozi wrote: I'm not particular to any of the verbs used yet, but maybe that's because I don't think of the <> as a general iterator, but more of a gobbler-type creature (and formerly a globber, too). Could we try: for $foo.fetch { ... } #or for $foo.grab { ... } #or for $foo.eat { ... }

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Austin Hastings
Dan Hursh wrote: Peter Behroozi wrote: I'm not particular to any of the verbs used yet, but maybe that's because I don't think of the <> as a general iterator, but more of a gobbler-type creature (and formerly a globber, too). Could we try: for $foo.fetch { ... } #or for $foo.grab { ... } #or for

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread chromatic
On Fri, 2004-08-20 at 14:26, Austin Hastings wrote: > Dan Hursh wrote: > > generalimpose scalarimpose list > > ----- > > D$foo.eat$foo.bite$foo.gobble > > N$foo.look$foo.peek$foo.peruse > > > > hmm, I don'

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Austin Hastings
Larry Wall wrote: On Fri, Aug 20, 2004 at 12:52:56PM -0700, Larry Wall wrote: : Unfortunately, the only obvious one, 's', is taken. I remind myself that 'S' is equally obvious, and not taken. Like _, it suffers from spacing issues, but could be the ASCII backup for the § character. (As Y is likel

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Dan Hursh
Chromatic wrote: On Fri, 2004-08-20 at 14:26, Austin Hastings wrote: Dan Hursh wrote: generalimpose scalarimpose list ----- D$foo.eat$foo.bite$foo.gobble N$foo.look$foo.peek$foo.peruse hmm, I don't like eat i

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Austin Hastings
chromatic wrote: On Fri, 2004-08-20 at 14:26, Austin Hastings wrote: Dan Hursh wrote: generalimpose scalarimpose list ----- D$foo.eat$foo.bite$foo.gobble N$foo.look$foo.peek$foo.peruse hmm, I don't l

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread Luke Palmer
Austin Hastings writes: > Larry Wall wrote: > >Hmm. Gotta decided if S$foo.bar() is too ugly to live though... > > > > It is. Agreed. > >I still kinda like underscore. > > > How about "scalar"? The fact that one person, one time, came up with a > need to invoke it doesn't mean we have to race

adverbs

2004-08-20 Thread John Williams
Adverbs are confusing me mightily lately. It may be that Larry's A12 revision just needs a few examples *with* parenthesis to straighten me out. Here are some semi-coherent attempts to sort it out in my mind. Please correct me where I have made mistakes. What is the rule(s) for when :foo is an

Re: adverbs

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 04:15:43PM -0600, John Williams wrote: : Adverbs are confusing me mightily lately. : : It may be that Larry's A12 revision just needs a few examples : *with* parenthesis to straighten me out. : : Here are some semi-coherent attempts to sort it out : in my mind. Please cor

Re: adverbs

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 04:18:55PM -0700, Larry Wall wrote: : Only a sig of () makes it *not* look for an argument as a list operator. That's overstated. Only a sig of () or ($x) or (?$x) suppresses list operator-ness on ordinary function names. Larry

Re: adverbs

2004-08-20 Thread Luke Palmer
Larry Wall writes: > On Fri, Aug 20, 2004 at 04:15:43PM -0600, John Williams wrote: > : > :say .meth :foo;# say( .meth( foo=>1 ) ) > > That one works. But that's because :foo is an adverb to .meth, not because .meth is taking an argument 'foo' => 1, right? > Likewise > > sqrt($x):bo

Re: adverbs

2004-08-20 Thread Larry Wall
On Fri, Aug 20, 2004 at 06:12:06PM -0600, Luke Palmer wrote: : Larry Wall writes: : > On Fri, Aug 20, 2004 at 04:15:43PM -0600, John Williams wrote: : > : : > :say .meth :foo;# say( .meth( foo=>1 ) ) : > : > That one works. : : But that's because :foo is an adverb to .meth, not because .m

Re: Synopsis 2 draft 1 -- each and every

2004-08-20 Thread John Siracusa
On 8/20/04 5:30 PM, Austin Hastings wrote: > How about "scalar"? The fact that one person, one time, came up with a > need to invoke it doesn't mean we have to race it up the huffman tree. > P6 is winning the DWIM race most of the time contextually. Maybe [#] as > a macro, if you like. Yeah, that'

A thought for later -- POD tables

2004-08-20 Thread Aaron Sherman
Larry Wall wrote: $_ $xType of Match ImpliedMatching Code == = == Any Code<$> scalar sub truth match if $x($_) This bit of POD made me think about POD's lack of tabular formatting, a common idiom in technical

Re: A thought for later -- POD tables

2004-08-20 Thread Luke Palmer
Aaron Sherman writes: > Larry Wall wrote: > > > $_ $xType of Match ImpliedMatching Code > > == = == > > Any Code<$> scalar sub truth match if $x($_) > > > This bit of POD made me think about POD's lack of tabular

Re: A thought for later -- POD tables

2004-08-20 Thread Larry Wall
On Sat, Aug 21, 2004 at 12:03:10AM -0600, Luke Palmer wrote: : I've already had my epiphany about POD, though, so I'll spare doing it : again. In short, there are two things that I see about POD that need to : change: : : =over : : =item 1) : : C<=directive> lines shouldn't have to be in their