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

2000-08-21 Thread Brust, Corwin
-Original Message- From: Damian Conway [mailto:[EMAIL PROTECTED]] And don't forget to include my idea that $ME be scoped locally like $AUTOLOAD, so that the "self" and "this" and "I" and "myself" camps can have their respective cakes but the rest of us don't have to eat them: [...]

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 a

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> c

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

2000-08-19 Thread Bryan C . Warnock
On Sat, 19 Aug 2000, Randal L. Schwartz wrote: > I'll have an adjacent cell. I actually like that *better* than $self. > Let's not stop there though. Perhaps we need "self" and "super" and > "thisContext". Only half joking... this would solve a lot of the > hacking issues. self could be a "die

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

2000-08-19 Thread Randal L. Schwartz
> "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 prior Perls!" you re-exclaim. Not if it only appears in a John

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

2000-08-19 Thread Nathan Wiger
Damian Conway wrote: > > 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? If not, I'll do it, but not u

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 m

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

2000-08-19 Thread Damian Conway
>From his padded room, Randal suggested: > > "John" == John Siracusa <[EMAIL PROTECTED]> writes: > > John> I don't like $ME either, but my alternative is probably even more > John> blasphemous: use $self. > > John> But wait, it gets worse: I'd even be happy with the bar

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

2000-08-19 Thread Randal L. Schwartz
> "Damian" == Damian Conway <[EMAIL PROTECTED]> writes: Damian> Don't give alternatives. Give a "these alternatives were considered and Damian> *rejected*" list. $ME is capitalized (like all "magic" vars), and short. I actually don't like the literal $ME. It usurps a variable name that has

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} ); >> > >> Y

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 oper

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

2000-08-18 Thread Damian Conway
> > my %students : sorted( $ME{^1}{GPA} <=> $ME{^0}{GPA} ); > > > Yes, I was thinking the same thing. Except the '$ME' thing--what's that? (I > must have missed that discussion...) It's an idea that within a method call, the object reference would not be passed as the first argument (

Re: RFC 124 (v1) Sort order for any hash as an example of attributes in action

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

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

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

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

2000-08-18 Thread Jonathan Scott Duff
On Fri, Aug 18, 2000 at 09:31:44AM +0100, Hildo Biersma wrote: > Ah, syntax - I have no idea. Well, syntax aside, how would this work? > One thing we could do, theoretically: > > %hash = ('James' => 'Gibbon', > 'Dave' => 'Mallon', > 'Pete' => 'Munro'); > > while (my ($key,

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

2000-08-18 Thread Jeremy Howard
Damian Conway wrote: >> How about >> >> %students : ( sort = $$students{^1}{GPA} <=> $$students{^0}{GPA} }); > > Weeird! :-) > > Since you've strayed so close, why not go all the way and make it an attribute: > > my %students : sorted( $ME{^1}{GPA} <=> $ME{^0}{GPA} ); > > Where the

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

2000-08-18 Thread Damian Conway
> How about > >%students : ( sort = $$students{^1}{GPA} <=> $$students{^0}{GPA} }); Weeird! :-) Since you've strayed so close, why not go all the way and make it an attribute: my %students : sorted( $ME{^1}{GPA} <=> $ME{^0}{GPA} ); Where the C attribute takes a blo

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 orde

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

2000-08-18 Thread Hildo Biersma
> =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 iterator, not on the hash variable. It should be possible to

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

2000-08-17 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 i

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 b

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

2000-08-17 Thread David L. Nicol
Damian Conway wrote: > >>%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. [david@nicol1 perl]$ perl -le '%nums = (1..20); print %nums{1}' C

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

2000-08-17 Thread Tom Hughes
In message <[EMAIL PROTECTED]> Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > A "sort function" will need to be added into the list of magics > maintained for every associative array. > > A set of macros in terms of sort will need to be defined which > replace keys, values, and each f

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. Isn't this better handled with a (revamped and faster) tie? tie %professors, 'Tie::Sorted', ^a->name cmp

RFC 124 (v1) Sort order for any hash

2000-08-17 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Sort order for any hash =head1 VERSION Maintainer: David Nicol <[EMAIL PROTECTED]> Date: 17 Aug 2000 Version: 1 Mailing List: [EMAIL PROTECTED] Number: 124 =head1 ABSTRACT Herein a new syntax is