develooper Front page | perl.perl6.language | Postings from September 2005

Re: k, v

Thread Previous | Thread Next
From:
Uri Guttman
Date:
September 24, 2005 07:37
Subject:
Re: k, v
Message ID:
x7ll1mh6ql.fsf@mail.sysarch.com
>>>>> "J" == Juerd  <juerd@convolution.nl> writes:

  J> Hashes are full of convenience, and Huffman would be proud:
  J>     %hash.keys      %hash>>.key
  J>     %hash.values    %hash>>.value
  J>     %hash.kv        zip(%hash.keys, %hash.values)

  J> One thing occurred to me: if hashes are worth all this, then why not
  J> abbreviate "keys" further to "k" (as in "kv"), and "values" to "v" (as
  J> in "kv"). This would allow us to rename "key" to "k" and "value" to "v"
  J> too, resulting in:

  J>     %hash.k         %hash>>.k
  J>     %hash.v         %hash>>.v
  J>     %hash.kv        zip(%hash.k, %hash.v)

huffman has its limits too. in general having single letter names for
anything is a poor idea. it makes it hard to search for, you limit it to
only one thing that can use that letter, it isn't always easy to
remember what a given letter is, etc. keys and values are short enough
and read much better. kv works because keyvalues is clunky and too
long. i wouldn't have minded .pairs or .each instead of kv. but alias
methods are easy to add. 

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About