Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-04 Thread Smylers
Larry Wall writes: But then are we willing to rename shift/unshift to pull/put? Yes. Cunshift is a terrible name; when teaching Perl I feel embarrassed on introducing it. Given the nature of many of the other changes in Perl 6, completely changing regexps for example, renaming a couple of

Re: state vs my

2004-12-04 Thread Larry Wall
On Fri, Dec 03, 2004 at 11:36:02PM -0800, Brent 'Dax' Royal-Gordon wrote: : Larry Wall [EMAIL PROTECTED] wrote: : So optimizing to a state variable won't necessarily help your loop : overhead, but it could help your subroutine overhead, at least in Perl : 5, if Perl 5 had state variables. Best

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Larry Wall
Okay, maybe I should have gone to bed, but I kept thinking about this. I'm starting to suspect it's time to haul out the operator I've been holding in reserve for lo these many years now, the unary =. Suppose we say that it iterates iterators, but also it recognizes certain things that aren't

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Larry Wall
On Fri, Dec 03, 2004 at 06:38:42PM -0800, Larry Wall wrote: : Might even just be a global multi sub that defaults to $*ARGS: : : multi sub *lines (IO ?$handle = $*ARGS) {...} : multi sub *lines (Str $filename) {...} : multi sub *lines (IO @handle) {...} : multi sub *lines (Str

Container method calls

2004-12-04 Thread Ashley Winters
Howdy, While browsing the updated synopses, I noticed a problem with how scalar container methods are called. Currently, both value methods and container methods are shown in the synopses as being called with C$foo.bar(). For several reasons, that doesn't work for me. The method conflict between

Re: specifying the key Type for a Hash

2004-12-04 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Larry Wall) wrote: S9 talk about it. We current have things like: my Cat %pet is shape(Str); and parameters to types are in square brackets, so it's more like: my %pet is Hash[:shape(Str) :returns(Cat)]; I still prefer shaped, for

Re: iteration (was Re: Angle quotes and pointy brackets)

2004-12-04 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Matt Diephouse) wrote: What I mean is that Perl takes an array and makes an iterator out of it. Sure, you probably don't think about it like that, but the behavior is the same (who says arrays need to iterate starting at element zero?). I probably

Re: iteration (was Re: Angle quotes and pointy brackets)

2004-12-04 Thread Matt Diephouse
On Sat, 04 Dec 2004 08:59:24 -0700, David Green [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Matt Diephouse) wrote: Supposing class Filehandle does Iterate; # Iterate or Iterator? we have an easy way to create new iterators. I'm not sure how useful they

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Herbert Snorrason
On Sat, 4 Dec 2004 01:37:00 -0800, Larry Wall [EMAIL PROTECTED] wrote: for =$*IN {...} for =$*ARGS {...} Yay. A generalised form of the input operator, which can create even handier idioms for simple file processing. Maybe I wasn't clear enough. My issue wasn't specifically with '.lines'

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Rod Adams
Larry Wall wrote: So you can say for =$*IN {...} for =$*ARGS {...} for =foo.c {...} for =foo.c foo.h {...} for =«$foo.c $foo.h» {...} for =['foo.c', 'foo.h'] {...} for =['.myrc', @*ARGS] {...} for [EMAIL PROTECTED] {...} for = {...} The simplicity is nice, but the

Re: state vs my

2004-12-04 Thread Alexey Trofimenko
On Fri, 3 Dec 2004 21:25:39 -0800, Larry Wall [EMAIL PROTECTED] wrote: On Sat, Dec 04, 2004 at 06:31:35AM +0300, Alexey Trofimenko wrote: : : for 1..10_000_000 { : my ($a,$b,$c) = ... : ... : } : : vs. : : for 1..10_000_000 { : state ($a,$b,$c) = ... : ... : } : :

iterators and functions (and lists)

2004-12-04 Thread Alexey Trofimenko
hm.. consider that: perl5: open $fh, 'file'; $first_line = $fh; @remaining = $fh; perl6: $fh = open 'file'; $first_line = $fh(); @remaining = $fh(); I thought about parallels between arrays and iterators, and realized that they aren't very close to each other: iterators are

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Stéphane Payrard
On Fri, Dec 03, 2004 at 06:38:42PM -0800, Larry Wall wrote: On Fri, Dec 03, 2004 at 06:43:05PM +, Herbert Snorrason wrote: : This whole issue kind of makes me go 'ugh'. One of the things I like : best about Perl is the amazing simplicity of the input construct. Hmm. while ()

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Alexey Trofimenko
On Sat, 04 Dec 2004 11:03:03 -0600, Rod Adams [EMAIL PROTECTED] wrote: Larry Wall wrote: for =$*IN {...} for =$*ARGS {...} for =foo.c {...} for =foo.c foo.h {...} for =$foo.c $foo.h {...} for =['foo.c', 'foo.h'] {...} for =['.myrc', @*ARGS] {...} for [EMAIL PROTECTED] {...}

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Alexey Trofimenko
On Sat, 04 Dec 2004 11:03:03 -0600, Rod Adams [EMAIL PROTECTED] wrote: Okay, this rant is more about the \s\s than \s=\s. To me, it is easier to understand the grouping of line 1 than line 2 below: if( $a$b $c$d ) {...} if( $a $b $c $d ) {...} In line2, my mind has to stop and ask: is that

Re: state vs my

2004-12-04 Thread Larry Wall
On Sat, Dec 04, 2004 at 08:03:45PM +0300, Alexey Trofimenko wrote: : P.S. : btw, what about : : my @rray; : # i'm starting to like that sigil is a part of name idea :) Too cute. But what about %ash and unction? Or is it ubroutine? losure? : for 1..10 { : { :push @rray, \(

Re: Container method calls

2004-12-04 Thread Larry Wall
On Sat, Dec 04, 2004 at 10:25:49AM -0700, Luke Palmer wrote: : Ashley Winters writes: : For several reasons, that doesn't work for me. The method conflict : between container methods and value methods should be obvious. What : should ((1|2)|(34)).values return? : : Well, there is an answer,

Re: iterators and functions (and lists)

2004-12-04 Thread Larry Wall
On Sat, Dec 04, 2004 at 08:03:53PM +0300, Alexey Trofimenko wrote: : hm.. consider that: : : perl5: :open $fh, 'file'; :$first_line = $fh; :@remaining = $fh; : : perl6: :$fh = open 'file'; :$first_line = $fh(); :@remaining = $fh(); : : I thought about parallels between

Re: specifying the key Type for a Hash

2004-12-04 Thread Larry Wall
On Sat, Dec 04, 2004 at 08:01:46AM -0700, David Green wrote: : In article [EMAIL PROTECTED], : [EMAIL PROTECTED] (Larry Wall) wrote: : S9 talk about it. We current have things like: : my Cat %pet is shape(Str); : and parameters to types are in square brackets, so it's more like: : my

Re: specifying the key Type for a Hash

2004-12-04 Thread David Wheeler
On Dec 4, 2004, at 10:57 AM, Larry Wall wrote: Well, I just put is shape because that's what the PDLers settled on, but as far as I'm concerned linguistically, it could just be is dim. That would settle the make-it-like-English question by making it not at all like English. On the aesthetic hand,

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread John Macdonald
On Sat, Dec 04, 2004 at 11:08:38PM +0300, Alexey Trofimenko wrote: On Sat, 04 Dec 2004 11:03:03 -0600, Rod Adams [EMAIL PROTECTED] wrote: Okay, this rant is more about the \s\s than \s=\s. To me, it is easier to understand the grouping of line 1 than line 2 below: if( $a$b $c$d ) {...}

Re: state vs my

2004-12-04 Thread Alexey Trofimenko
On Sat, 4 Dec 2004 11:33:10 -0800, Larry Wall [EMAIL PROTECTED] wrote: On Sat, Dec 04, 2004 at 08:03:45PM +0300, Alexey Trofimenko wrote: : P.S. : btw, what about : : my @rray; : # i'm starting to like that sigil is a part of name idea :) : for 1..10 { : { :push @rray, \( state

Re: Container method calls

2004-12-04 Thread Ashley Winters
On Sat, 4 Dec 2004 11:15:14 -0800, Larry Wall [EMAIL PROTECTED] wrote: On Sat, Dec 04, 2004 at 10:25:49AM -0700, Luke Palmer wrote: : But this convention provides much more accuracy than memorizing a list : of methods that don't automatically thread, or memorizing a list of : iterator methods

Re: iterators and functions (and lists)

2004-12-04 Thread Matthew Walton
Larry Wall wrote: : of course, that analogy isn't going to work for true functions, which : returns the same all the time, for some given set of arguments. Oh, well, we pissed off the mathematicians long ago. :-) At least we had the sense to call them subroutines instead of functions. Of

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-04 Thread Larry Wall
On Sat, Dec 04, 2004 at 01:24:41PM -0800, Larry Wall wrote: : I suppose we could also have : : for words {...} : for tokens {...} : for paragraphs {...} : for chunks(, :delim(/^^===+\h*\n/)) {...} : : etc. I see a problem with for words {...} since there's likely to be

Re: iteration (was Re: Angle quotes and pointy brackets)

2004-12-04 Thread Brent 'Dax' Royal-Gordon
David Green [EMAIL PROTECTED] wrote: Aren't lazy lists a funny kind of iterator? Ones that memoise their results. And supply an indexing method []. As I mentioned the other day, I fail to see any material difference between an iterator and a lazy list, except that a few operations are allowed

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-04 Thread Brent 'Dax' Royal-Gordon
Smylers [EMAIL PROTECTED] wrote: Yes. Cunshift is a terrible name; when teaching Perl I feel embarrassed on introducing it. Cunshift's only virtue, IMHO, is that it's clearly the inverse of Cshift. But I think the spelling and aural relationship between Cpush, Cpop, Cpull, and Cput is clear

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-04 Thread Rod Adams
Brent 'Dax' Royal-Gordon wrote: Smylers [EMAIL PROTECTED] wrote: Yes. Cunshift is a terrible name; when teaching Perl I feel embarrassed on introducing it. Cunshift's only virtue, IMHO, is that it's clearly the inverse of Cshift. But I think the spelling and aural relationship between

Required whitespace issues.

2004-12-04 Thread Rod Adams
Alexey Trofimenko wrote: On Sat, 04 Dec 2004 11:03:03 -0600, Rod Adams [EMAIL PROTECTED] wrote: Okay, this rant is more about the \s\s than \s=\s. To me, it is easier to understand the grouping of line 1 than line 2 below: if( $a$b $c$d ) {...} if( $a $b $c $d ) {...} In line2, my mind has

Re: Required whitespace issues.

2004-12-04 Thread Rod Adams
Larry Wall wrote: On Sat, Dec 04, 2004 at 08:14:17PM -0600, Rod Adams wrote: : In fact, unary = imposes whitespace requirements on all ops that end in =. Not true. I guess not all cases. But several do in certain situations. $x ==$foo; # $x == $foo; $x = =$foo; @x ==$foo; # @x = =$foo; @x

Re: Container method calls

2004-12-04 Thread Luke Palmer
Larry Wall writes: : But this convention provides much more accuracy than memorizing a list : of methods that don't automatically thread, or memorizing a list of : iterator methods that act on the iterator and not its current value. Except that you don't actually have to memorize a list.

Re: state vs my

2004-12-04 Thread Larry Wall
On Sun, Dec 05, 2004 at 02:15:51AM +0300, Alexey Trofimenko wrote: : I thought, its primary use is for closures: : : sub test { : my $a=10; : return sub { $a++ } : } : : vs : sub test { : return sub {state $a=10; $a++ } : } : : $func1 = test; : $func2 = test; : : would

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-04 Thread Dan Brian
Cunshift's only virtue, IMHO, is that it's clearly the inverse of Cshift. But I think the spelling and aural relationship between Cpush, Cpop, Cpull, and Cput is clear enough to negate that. But then, I'm a little biased. Except that push and pull are logical opposites linguistically, but not in

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-04 Thread Brent 'Dax' Royal-Gordon
On Sat, 4 Dec 2004 23:33:24 -0700, Dan Brian [EMAIL PROTECTED] wrote: If there's a willingness to rename shift/unshift, why not consider going a bit further (and offend shell heritage) to note that pull/put aren't really linguistically opposed either (unlike push/pull). Why not rename pop to