Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)

2000-08-21 Thread Piers Cawley
Damian Conway [EMAIL PROTECTED] writes: Errr. I would imagine that $ME contains: * a reference to the object, within an object method * the name of the class, within a class method * a reference to the *subroutine* itself, within a non-method. Ooh, recursive anonymous

Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)

2000-08-20 Thread Graham Barr
On Sat, Aug 19, 2000 at 09:32:50AM -0700, Randal L. Schwartz wrote: "John" == John Siracusa [EMAIL PROTECTED] writes: John I don't like $ME either, but my alternative is probably even more John blasphemous: use $self. "It usurps a variable name that has been legal for John customer use in

Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)

2000-08-19 Thread Damian Conway
It's an idea that within a method call, the object reference would not be passed as the first argument (or maybe, not *just* as the first argument), but in a variable named $ME. I was pushing that envelope a little. Is this RFC'ed yet? It may have been mentioned

RE: RFC 124 (v1) Sort order for any hash

2000-08-18 Thread Brust, Corwin
snip -Original Message- From: David L. Nicol [mailto:[EMAIL PROTECTED]] How about %students : ( sort = $$students{^1}{GPA} = $$students{^0}{GPA} }); /snip O, this is cool. snip -Original Message- my %students : sorted( $ME{^1}{GPA} = $ME{^0}{GPA}

Re: RFC 124 (v1) Sort order for any hash

2000-08-18 Thread David L. Nicol
And not only is it less to write, as a programmer, but you can abstract a general "sort these records by GPA" routine and everything can use the same one, fewer memory pages to dirty. Damian Conway wrote: my %students : sorted( $ME{^1}{GPA} = $ME{^0}{GPA} ); Yes, I was

Re: RFC 124 (v1) Sort order for any hash

2000-08-18 Thread David L. Nicol
Isn't this better handled with a (revamped and faster) tie? tie %professors, 'Tie::Sorted', ^a-name cmp ^b-name; tie %students, 'Tie::Sorted', $$students{^1}{GPA} = $$students{^0}{GPA} }; Damian It's a shorthand for it. And the other

Re: RFC 124 (v1) Sort order for any hash

2000-08-18 Thread Hildo Biersma
"David L. Nicol" wrote: Hildo Biersma wrote: =head1 ABSTRACT Herein a new syntax is introduced to specify a sort function for the keys of any hash. =head1 DESCRIPTION %professors{ $a-name cmp $b-name }; I feel the sort order should be specified on the

Re: RFC 124 (v1) Sort order for any hash : syntax as a macro, more laziness

2000-08-18 Thread David L. Nicol
Jonathan Scott Duff wrote: Does the presence of an ordering subroutine cause perl to generate a linked list of all the elements of the %hash in the proper sequence prior to iteration (and somehow attach it to the iterator)? Seems like everytime we did that it would generate a new

Re: RFC 124 (v1) Sort order for any hash

2000-08-17 Thread Damian Conway
%professors{ $a-name cmp $b-name }; %students{ $$students{$b}{GPA} = $$students{$a}{GPA} }; These already mean something. Please don't "special-case" them. No they don't. Apologies. You're quite correct. Isn't this better handled with a