-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:
[...]
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
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
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
> "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
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
> > 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
>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
> "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
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
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
> > 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 (
"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
-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
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,
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
> 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
"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
> =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
> > 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
> >>%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
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
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
>%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
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
25 matches
Mail list logo