>>>>> "mab" == mark a biggar <mark.a.big...@comcast.net> writes:

  mab> -------------- Original message ----------------------
  mab> From: Larry Wall <la...@wall.org>
  >> On Thu, Dec 11, 2008 at 02:24:54PM +0100, TSa wrote:
  >> > My idea is to let a pair numify to whatever the value numifies to.
  >> > Same thing with stringification. In general I think that a pair should
  >> > hide its key as far as possible if used as non-pair.
  >> 
  >> This makes sense to me, but I'd like to see any use cases to the
  >> contrary, if anyone can think of one.

  mab> The only use case I can think of is sorting a list of pairs;
  mab>  should it default to sort by key or value?

the default should be sort by key since that is used way more often than
sort by value. well, at least it seems that way to me. but if you use a
key description sort it may be trivial either way. something like
(broken p6):

        @pairs.sort( .key ) ;
        @pairs.sort ;           # same thing if key is the default
        @pairs.sort( .val ) ;

or even using the single letter method names (i dunno what is supported
now):

        @sorted = @pairs.sort(.k) ;
        @sorted = @pairs.sort(.v) ;

and if i am correct, no assignment would mean in-place sorting which is
wanted.

so you could default to sorting pairs by keys and not bother too many.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

Reply via email to