Re: rethinking printf

2002-03-18 Thread Jim Cromie
Rich Morin wrote: At 11:24 PM -0500 3/6/02, Uri Guttman wrote: qn would be just like qq but not allow any direct hash interpolations (%foo or %foo{bar}). you can always get those with $() if needed. this solves the common case with a minimal of noise and the uncommon case has a

Re: rethinking printf

2002-03-18 Thread Luke Palmer
On Mon, 18 Mar 2002, Jim Cromie wrote: Rich Morin wrote: At 11:24 PM -0500 3/6/02, Uri Guttman wrote: qn would be just like qq but not allow any direct hash interpolations (%foo or %foo{bar}). you can always get those with $() if needed. this solves the common case with a

Re: rethinking printf

2002-03-11 Thread ianb
On 10 Mar 02 at 11:14:26PM, Uri Guttman wrote: i really think that the printf format spec is so standard and ingrained that changing it with # for % or requiring \% is not a good idea. but then again, backwards compatibility is not a rule you must always obey. i just think in this case it

Re: rethinking printf

2002-03-11 Thread Tony Hall
On 10 Mar 02 at 11:14:26PM, Uri Guttman wrote: i really think that the printf format spec is so standard and ingrained that changing it with # for % or requiring \% is not a good idea. but then again, backwards compatibility is not a rule you must always obey. i just think in this case it

Re: rethinking printf

2002-03-10 Thread abigail
On Wed, Mar 06, 2002 at 11:15:30PM -0500, Uri Guttman wrote: BL == Bart Lateur [EMAIL PROTECTED] writes: BL On Wed, 6 Mar 2002 17:57:07 -0500, Uri Guttman wrote: how often will you need to interpolate a hash? BL A whole hash: quite rarely. A hash item: a LOT. Don't forget that

Re: rethinking printf

2002-03-10 Thread Uri Guttman
a == abigail [EMAIL PROTECTED] writes: a On Wed, Mar 06, 2002 at 11:15:30PM -0500, Uri Guttman wrote: good point. $() can still wrap that but then there has to be a balance between printf strings and double quoters. how about this wacky idea: make a new type of string where

RE: rethinking printf

2002-03-10 Thread Brent Dax
Uri Guttman: # i disagree. but we shall see if larry is listening to this thread and # will back away from hash interpolation or take some of our suggestions # that make it work without killing format strings. i hate to see a # special call or wierd syntax for that. my qn (or qf) # suggestion

RE: rethinking printf

2002-03-10 Thread Brent Dax
Abigail: # I'd think it would be much better that '%' followed by a word *not* # followed by a { isn't interpolated. Granted, you cannot do # interpolation # of hashes (well, one could always write @{[%hash]}, just # like in perl5, # and there's little change of clashing with printf formats. #

Re: rethinking printf

2002-03-10 Thread Uri Guttman
BD == Brent Dax [EMAIL PROTECTED] writes: BD I think qn counts as weird syntax. I ask again, what's wrong with one BD of: BD sprintf(%hash\%s, $string); BD sprintf(%hash.'%s', $string); BD sprintf('%s%s', _%hash, $string); what if you want to use %hash{width} as a field

RE: rethinking printf

2002-03-10 Thread Brent Dax
Uri Guttman: # BD == Brent Dax [EMAIL PROTECTED] writes: # # BD I think qn counts as weird syntax. I ask again, what's # wrong with one # BD of: # # BD sprintf(%hash\%s, $string); # # BD sprintf(%hash.'%s', $string); # BD sprintf('%s%s', _%hash, $string); # #

Re: rethinking printf

2002-03-10 Thread Eugene van der Pijll
Why not replace the escape character '%' with '#'? No new quoting operators or functions to learn. And introduce a warning if there are no #'s in the format string. Eugene

Re: rethinking printf

2002-03-10 Thread Uri Guttman
BD == Brent Dax [EMAIL PROTECTED] writes: BD Uri Guttman: BD # $prec = %hash{width} ; BD # sprintf( qf%${prec}s, $string); BD # BD # sprintf( \%${prec}s, $string); BD # BD # is one of your alternatives. :-/ BD You forgot one. BD sprintf('%'_%hash{width}_'s', $string);

Re: rethinking printf

2002-03-10 Thread Peter Scott
At 01:39 AM 3/11/02 +0100, Eugene van der Pijll wrote: Why not replace the escape character '%' with '#'? No new quoting operators or functions to learn. Beat me to it. And introduce a warning if there are no #'s in the format string. Maybe if it's a constant, but not if you're doing something

Re: rethinking printf

2002-03-07 Thread Rich Morin
At 11:24 PM -0500 3/6/02, Uri Guttman wrote: qn would be just like qq but not allow any direct hash interpolations (%foo or %foo{bar}). you can always get those with $() if needed. this solves the common case with a minimal of noise and the uncommon case has a simple out of using $(). no

Re: rethinking printf

2002-03-07 Thread Dmitry Kohmanyuk
On Wed, Mar 06, 2002 at 11:24:57PM -0500, Uri Guttman wrote: that is another point. not allowing a complete hash to interpolate. but what defines that? what if you wanted %s{bar} and that was a format and not a hash and in a double quoted string? my proposal handles that well with no major

Re: rethinking printf

2002-03-06 Thread Uri Guttman
BC == Bernie Cosell [EMAIL PROTECTED] 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

Re: rethinking printf

2002-03-06 Thread Bart Lateur
On Wed, 6 Mar 2002 17:57:07 -0500, Uri Guttman wrote: how often will you need to interpolate a hash? A whole hash: quite rarely. A hash item: a LOT. Don't forget that $foo{BAR} will now become %foo{BAR} -- Bart.

Re: rethinking printf

2002-03-06 Thread Austin Hastings
--- Bart Lateur [EMAIL PROTECTED] wrote: On Wed, 6 Mar 2002 17:57:07 -0500, Uri Guttman wrote: how often will you need to interpolate a hash? A whole hash: quite rarely. A hash item: a LOT. Don't forget that $foo{BAR} will now become %foo{BAR} Of course, it could also become %s. Or _

RE: rethinking printf

2002-03-06 Thread Brent Dax
Uri Guttman: # printf %d hash is $(%foo.string), $bar ; # # no ambiguity and no confusion. how often will you need to # interpolate a # hash? As others have pointed out, %foo{BAR} has to work. But I have another question for you: what's wrong with sprintf '%d hash is %s', $bar,

Re: rethinking printf

2002-03-06 Thread Uri Guttman
BL == Bart Lateur [EMAIL PROTECTED] writes: BL On Wed, 6 Mar 2002 17:57:07 -0500, Uri Guttman wrote: how often will you need to interpolate a hash? BL A whole hash: quite rarely. A hash item: a LOT. Don't forget that BL $foo{BAR} will now become %foo{BAR} good point. $() can still

Re: rethinking printf

2002-03-06 Thread Uri Guttman
BD == Brent Dax [EMAIL PROTECTED] writes: BD Uri Guttman: BD # printf %d hash is $(%foo.string), $bar ; BD # BD # no ambiguity and no confusion. how often will you need to BD # interpolate a BD # hash? BD As others have pointed out, %foo{BAR} has to work. But I have