develooper Front page | perl.fwp | Postings from March 2002

Re: rethinking printf

Thread Previous | Thread Next
From:
Uri Guttman
Date:
March 6, 2002 14:57
Subject:
Re: rethinking printf
Message ID:
200203062257.RAA06893@home.sysarch.com.
>>>>> "BC" == Bernie Cosell <bernie@fantasyfarm.com> writes:

<cced perl6-language>

  BC> I wonder if the solution is to look at it the other way: that you
  BC> have to do something to get interpolation to happen.  If we look
  BC> at it from the old adage of making the more common things simpler,
  BC> at least in my code I very rarely interpolate arrays [and I
  BC> suspect I'd even LESS often interpolate hashes], I wouldn't mind
  BC> the syntax going the other way -- maybe "@" never interpolates and
  BC> you need to do "\@" to make interpolation happen [and then
  BC> similarly with '%']...  This is also simlar to the logic behind
  BC> Perl's reversing the longstanding unix convention WRT to chars
  BC> like '(' in REs.

that is a good idea. the @() and $() things will interplate any
expressions into strings. so use a method on the hash to get a string
out and wrap it in $().

	printf "%d hash is $(%foo.string)", $bar ;

no ambiguity and no confusion. how often will you need to interpolate a
hash? so make it more cumbersome as it is a rare thing. that is larry's
credo from way back. breaking % in a s/printf format is not good as that
is the very common thing to do.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl 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