develooper Front page | perl.perl6.language | Postings from December 2004

Re: pull & put

From:
Uri Guttman
Date:
December 5, 2004 08:42
Subject:
Re: pull & put
Message ID:
x7vfbgitnl.fsf@mail.sysarch.com
>>>>> "RA" == Rod Adams <rod@rodadams.net> writes:

  RA> Brent 'Dax' Royal-Gordon wrote:

  >> Smylers <smylers@stripey.com> wrote:
  >> 
  >>> Yes.  C<unshift> is a terrible name; when teaching Perl I feel
  >>> embarrassed on introducing it.
  >>> 
  >> 
  >> C<unshift>'s only virtue, IMHO, is that it's clearly the inverse of
  >> C<shift>.  But I think the spelling and aural relationship between
  >> C<push>, C<pop>, C<pull>, and C<put> is clear enough to negate that.
  >> 
  >> But then, I'm a little biased.
  >> 
  RA> Except that push and pull are logical opposites linguistically, but
  RA> not in standard CS parlance. could be very confusing.

  RA> There's a possibility of using C<enq> and C<deq> for enqueue/dequeue,
  RA> except that C<deq> == C<pop> in standard implementations.

  RA> So C<enq> and C<shift>? yeck.

what about get/put for queue stuff? they don't conflict with
push/pop/(un)shift so we can keep them. they would be synonyms for
shift/push on arrays but do the right thing for queues and other
unlimited things. and get/put are also an historical pair of computer
terms that are well known (pl/i and others). and they are nice and short
too so they make huffman feel good. :)

so you could use get/put on arrays or queues but only them on queues.

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



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