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

[email protected] ("David L. Nicol")
Newsgroups perl.perl6.language.objects
Organization University of Missouri - Kansas City supercomputing infrastructure
Message-ID <[email protected]>
> > 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 thing, I don't want to overload everything, just the
iterator.  And not really so much to have sorted hashes, but to explore
syntaces for getting into the internals of the containers without
defining entirely new containers (tie)


How about
	
	%students : ( sort = $$students{^1}{GPA} <=> $$students{^0}{GPA} });

which uses the C< : qualifier> syntax to indicate a new-with-perl6 thing,
and uses it in a new way, assigning a value to the qualifier, as indcated
by the round brackets.


Suggesting that qualifiers can be assigned to, as well as flagging.


-- 
                          David Nicol 816.235.1187 [email protected]
                      Does despair.com sell a discordian calendar?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.