Re: Synopsis 2 draft 1 -- .as()

2004-08-19 Thread Plato
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Larry Wall) wrote: On Sat, Aug 14, 2004 at 09:56:34PM +, Smylers wrote: : I like that exception; it means that if all your array elements end with : line-breaks, you don't end up with all but the first one being indented [...] That's the

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread David Green
On 8/15/04, [EMAIL PROTECTED] (David Wheeler) wrote: On Aug 14, 2004, at 5:52 PM, Larry Wall wrote: for all $*IN # all() is junction for each $*IN # each method wants closure if we follow Ruby for next $*IN # next $foo is a loop exit Hmm. Maybe the problem is that we shouldn't

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread David Green
On 8/19/04, [EMAIL PROTECTED] (David Green) wrote: On Aug 14, 2004, at 5:52 PM, Larry Wall wrote: for all $*IN # all() is junction for each $*IN # each method wants closure if we follow Ruby for next $*IN # next $foo is a loop exit [...] Each and every are the obvious choices,

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Luke Palmer
David Green writes: On 8/19/04, [EMAIL PROTECTED] (David Green) wrote: On Aug 14, 2004, at 5:52 PM, Larry Wall wrote: for all $*IN # all() is junction for each $*IN # each method wants closure if we follow Ruby for next $*IN # next $foo is a loop exit [...] Each and every

Re: Synopsis 2 draft 1

2004-08-19 Thread Mark J. Reed
On 2004-08-18 at 22:37:31, Larry Wall wrote: Actually, I've settled on .perl for now, on the assumption there could also be a .python, a .ruby, a .cobol, a .intercal, etc. Perhaps there should be a special name visible only at the language level that automatically translates to

Re: Return with no expression

2004-08-19 Thread Luke Palmer
Matt Diephouse writes: use CGI qw(:standard); my $foo = Bar-new( name = Baz, value = param('baz'), something = 'else' ); See the problem? Yikes, yeah, that seems so innocent. Cparam uses Creturn;. In this example, it's called in list context.

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Dan Hursh
David Green wrote: ...but print next $foo is better than print each $foo. ... print another $foo for another $foo {...} while another $foo {..} It's 5 characters too many, but it works. Dan

Re: Return with no expression

2004-08-19 Thread Juerd
Matt Diephouse skribis 2004-08-19 9:35 (-0400): But I came across this code at work this week: use CGI qw(:standard); my $foo = Bar-new( name = Baz, value = param('baz'), something = 'else' ); Ouch. You have foo-bar-baz code *at work*? :) See the

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Jonathan Scott Duff
On Thu, Aug 19, 2004 at 10:38:48AM -0500, Dan Hursh wrote: David Green wrote: ...but print next $foo is better than print each $foo. ... print another $foo for another $foo {...} while another $foo {..} It's 5 characters too many, but it works. print more $foo; for more $foo {

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Larry Wall
On Thu, Aug 19, 2004 at 05:08:55AM -0600, Luke Palmer wrote: : Well, Cfor $foo gives you a one-iteration loop. But perhaps list : flatten could work on iterators: : : for *$foo { ... } I dislike that purely on visual grounds in the case of for *$*IN { ... } But I expect most folks

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Matt Diephouse
On Thu, 19 Aug 2004 10:38:48 -0500, Dan Hursh [EMAIL PROTECTED] wrote: while another $foo {..} It's 5 characters too many, but it works. Dan 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

Re: Return with no expression

2004-08-19 Thread Matt Diephouse
On Thu, 19 Aug 2004 17:52:18 +0200, Juerd [EMAIL PROTECTED] wrote: Ouch. You have foo-bar-baz code *at work*? :) Unfortunately, some of the code here is much worse than that. In fact, this was anticipated and the doesn't-exist case is explicitly documented as: If the parameter does not

Re: Return with no expression

2004-08-19 Thread Luke Palmer
Matt Diephouse writes: The point that it's documented for Cparam and for Creturn doesn't remove the fact that while this DWIM the majority of the time, it can be the cause of a subtle bug. I'm sure many people don't know about the DWIM behavior. Or aren't actively aware of it. As is the case

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Smylers
Matt Diephouse writes: for $foo.records :sep, { ... } The trouble is that using a for loop builds a list in memory, which can be troublesome. I think that in Perl 6 Cfor doesn't build a list in memory, so as to avoid the troublesome bits. Smylers

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Larry Wall
On Thu, Aug 19, 2004 at 10:53:06AM -0500, Jonathan Scott Duff wrote: : I like each best though. Why exactly can't it work? It could be made to work. The sources of cognitive interference are: 1. Perl 5's each(%hash) function, which is probably not a problem. 2. Ruby's array.each {|x|

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Luke Palmer
Larry Wall writes: next D next N all D all N == == = = $iter $iter.read ?1 $iter.read ?2 @array @array.shift@array.for

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Paul Seamons
After all, a pull is the other end of a push. Larry So do we also get: %hash.push(key = 'value'); # harder than %hashkey = 'value'; %hash.unshift; # same as %hash.push %hash.shift; # same as %hash.pull %hash.pop; # same as %hash.pull Which then begs if you can do @array.push(3 = 'value'); #

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Paul Seamons
On Thursday 19 August 2004 02:14 pm, Paul Seamons wrote: @array.push(3 = 'value'); # index 3 gets 'value' Hmm. Well that makes it hard to have an array of pairs - so never mind. Paul Seamons

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread John Macdonald
On Thu, Aug 19, 2004 at 12:31:42PM -0700, Larry Wall wrote: So let's rewrite the table (assuming that all the hash methods are just variants of .values), where N and D are non-destructing and destructive: next D next N all D all N

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Larry Wall
On Thu, Aug 19, 2004 at 01:54:39PM -0600, Luke Palmer wrote: : That is very tickley. But there's another kind of dissonance there. : @array.pull needs to take arguments[1] when called with list pull, : otherwise it's basically useless. It's not useless if you just want to interpolate an entire

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Larry Wall
On Thu, Aug 19, 2004 at 05:26:38PM -0400, John Macdonald wrote: : In scalar context a non-destructive read of an iterator might : be called $iter.peek and the next .read will get (and remove) : the same value that .peek returns. Implementation would be : fairly simple - the control info for an

Re: Return with no expression

2004-08-19 Thread David Wheeler
On Aug 19, 2004, at 9:41 AM, Matt Diephouse wrote: If the parameter does not exist at all, then param() will return undef in a scalar context, and the empty list in a list context. Sure enough. And I've even read a large percentage of the (unwieldy) CGI.pm docs. But I was using Cparam as

Re: Return with no expression

2004-08-19 Thread David Wheeler
On Aug 19, 2004, at 11:07 AM, Aaron Sherman wrote: First off, in Perl 6, I *think* that that C = will enforce a scalar context (it's a tuple operator, last I recall). W00t! Second, in Perl 5 it should not be hard to identify such situations for warning purposes. C = may be a synonym for C,, but

Synopsis 4 draft 1

2004-08-19 Thread Larry Wall
=head1 Title Synopsis 4: a Summary of Apocalypse 4 =head1 Author Larry Wall [EMAIL PROTECTED] =head1 Version Maintainer: Date: Last Modified: Number: 4 Version: 0 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. =head1 The