Re: bad code to good golf

Uri Guttman <[email protected]> Sun, 09 Dec 2007 19:42:59 -0500
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
>>>>> "MGS" == Michael G Schwern <[email protected]> writes:

  MGS> Uri Guttman wrote:
  >> is there any guarantee of evaluation order in arg lists? will the
  >> bless/splice always be executed before the pop?

  MGS> I believe it is undefined, so it's not recommended that you do
  MGS> anything order dependent in the argument list.  But it is stable.

so that breaks the pop solutions IMO. it may not always work in all perl
versions.

  >> my longer but amusing answer is this:
  >> 
  >> sub new {
  >> bless{reverse%{{reverse@_}}}
  >> }
  >> 
  >> it is not warning safe and it leaves '' => CLASS in the hash. but it has
  >> no temp vars, calls to splice or shift.

  MGS> You fell into the trap!  That's an improper constructor, can you tell us why?

i forgot the shift of the class arg which i had on my test code. it was
a paste error. and it makes it even longer.

uri

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