Re: printf-like formatting in interpolated strings

2003-08-14 Thread Larry Wall
Sorry to drag out an old conversation, but I was indisposed at the time, and only just got back to it. On Mon, Jun 16, 2003 at 01:07:21PM +0200, Edwin Steiner wrote: : Edwin Steiner <[EMAIL PROTECTED]> writes: : : > Disallowing interpolated formats on \F has the additional advantage of : > making

Re: printf-like formatting in interpolated strings

2003-06-29 Thread Jonadab the Unsightly One
This was a few days ago, but I just noticed Tim Bunce's comment about the way other languages do it and thought of the way it is in another language I know (one that a lot of people don't know), so I'm chiming in briefly... Austin Hastings <[EMAIL PROTECTED]> writes: > How about a pre- or user-

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Tim Bunce
Perhaps someone could post a summary of how the issue has been tackled in other languages that support a similar concept. I've not seen one (but then I've not been paying attention, so forgive me if it's need done already, and perhaps point me to a url). Tim.

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Tim Bunce
On Mon, Jun 16, 2003 at 05:48:58PM +0100, Simon Cozens wrote: > > But then I'm one of those freaks who likes the idea of keeping core Perl 6 > generic, extensible, clean and small, and letting all the clever stuff go > into extensions, a heretical position which is way out of favour with the > mo

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Simon Cozens
[EMAIL PROTECTED] (Austin Hastings) writes: > replacing, or merging, formats with emit-rules > seems like an interesting project. I dunno, I think it fires my "change for the sake of change" alarm bells. So far we're already throwing away thirty years of^W^W^W^W^W^Wrationalising one Unix little l

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Austin Hastings
--- David Storrs <[EMAIL PROTECTED]> wrote: > On Mon, Jun 16, 2003 at 11:37:06AM -0700, Michael Lazzaro wrote: > > [...] > > But there is broad support for the idea that the somewhat elderly > > printf syntax is a PITA, and that printf, in general, should be > > completely unnecessary since we a

Re: printf-like formatting in interpolated strings

2003-06-16 Thread David Storrs
On Mon, Jun 16, 2003 at 11:37:06AM -0700, Michael Lazzaro wrote: > [...] > But there is broad support for the idea that the somewhat elderly > printf syntax is a PITA, and that printf, in general, should be > completely unnecessary since we already *have* interpolated strings, > fer pete's sake.

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Austin Hastings
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > On Monday, June 16, 2003, at 11:49 AM, Austin Hastings wrote: > > --- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > > >> Or, if we have "output rules" just like we have "input rules", > could > >> something quite complex be expressed simply as:

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Michael Lazzaro
On Monday, June 16, 2003, at 11:49 AM, Austin Hastings wrote: --- Michael Lazzaro <[EMAIL PROTECTED]> wrote: Or, if we have "output rules" just like we have "input rules", could something quite complex be expressed simply as: "You have <$x as MoneyFormat>" having previously defined your Money

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Austin Hastings
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > Or, if we have "output rules" just like we have "input rules", could > something quite complex be expressed simply as: > > "You have <$x as MoneyFormat>" > > having previously defined your MoneyFormat "formatting rule" in some > other locat

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Michael Lazzaro
On Monday, June 16, 2003, at 10:39 AM, Edwin Steiner wrote: I'm content if this will be revisited (hopefully by someone with better overview than mine). It just should not be ignored. Oh, it definitely won't be ignored. :-) It's come up several times before -- try searching for "stringification"

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Simon Cozens <[EMAIL PROTECTED]> writes: > it was addressing a problem at too low a level. This could be because I'm a > grouchy old-timer, and I carry over a Perl 5 design principle that says that > changes should be made in as general a way as possible. It's a very good principle, I think. One

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Simon Cozens
[EMAIL PROTECTED] (Edwin Steiner) writes: >Description: This list is for discussing user-visible changes to >the language. > > It's somewhat unnerving to post on topic and (hopefully) politely and I think your post was spot on; the only problem I had with it is that I felt it was addressin

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Simon Cozens <[EMAIL PROTECTED]> writes: > % grep printf cvs/modules/**/*pm | wc -l > 15 > % grep -v printf cvs/modules/**/*pm | wc -l > 15360 > > Well, 0.1% agreed, anyway. Could also mean the current printf syntax is not too popular. Reusable code is also less likely to use it than the

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Mark J. Reed
On 2003-06-16 at 17:48:58, Simon Cozens wrote: > % grep printf cvs/modules/**/*pm | wc -l > 15 > % grep -v printf cvs/modules/**/*pm | wc -l > 15360 > > Well, 0.1% agreed, anyway. Now, now, that's hardly a fair comparison. Maybe if you grepped for lines that contain "print" but not "pri

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Simon Cozens
[EMAIL PROTECTED] (Edwin Steiner) writes: > Well, it's a bike shed. Perhaps best not to have people expend lots of energy painting bike sheds until the nuclear reactor's anywhere near functional, though. I think the whole thing can be done, in whatever style people would like, using whatever natt

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Austin Hastings <[EMAIL PROTECTED]> writes: > Now, if you want to talk about the cool amazing formatting syntax > you've conceived for sprintf replacement, that's fine. But I'm getting > that warm cozeny feeling that this is burning unnecessary listmips. Well, it's a bike shed. But it is a bike s

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Austin Hastings
--- arcadi shehter <[EMAIL PROTECTED]> wrote: > Luke Palmer writes: > > > > > As far as the syntax, the () and {} don't make a lot of sense with > > regard to the rest of the language. We could either utilize the > > string/numeric context distinction that already exists in {} and > [] > >

Re: printf-like formatting in interpolated strings

2003-06-16 Thread arcadi shehter
Luke Palmer writes: > > As far as the syntax, the () and {} don't make a lot of sense with > regard to the rest of the language. We could either utilize the > string/numeric context distinction that already exists in {} and [] > for subscripting, or we could always use () in analog to $().

Re: printf-like formatting in interpolated strings

2003-06-16 Thread David Storrs
On Mon, Jun 16, 2003 at 02:09:43PM +0200, Edwin Steiner wrote: > Edwin Steiner <[EMAIL PROTECTED]> writes: > > We know: Everything between the \F and the next funny character is the > format specifier. This allows extensions to the printf-specifiers: Cool, Perlish, scary. > Examples: > [snip] >

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Edwin Steiner <[EMAIL PROTECTED]> writes: > The rule could be like: > > \\F After-afterthought: We know: Everything between the \F and the next funny character is the format specifier. This allows extensions to the printf-specifiers: (These extension and more could also be used in C.) ru

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Edwin Steiner <[EMAIL PROTECTED]> writes: > Disallowing interpolated formats on \F has the additional advantage of > making the {} unnecessary in the most common cases (also removing the > 'force to string'). As an afterthought: This suggests getting rid of the {} entirely. The rule could be lik

Re: printf-like formatting in interpolated strings

2003-06-16 Thread Edwin Steiner
Luke Palmer <[EMAIL PROTECTED]> writes: > As far as the syntax, the () and {} don't make a lot of sense with > regard to the rest of the language. We could either utilize the > string/numeric context distinction that already exists in {} and [] > for subscripting, or we could always use () in ana

Re: printf-like formatting in interpolated strings

2003-06-15 Thread Luke Palmer
> Hello! > > Recently I was coding Perl 5 and quite often I had to change > interpolated strings or C to C or . > > I began to wonder, if qq strings couldn't allow sprintf-like > formatting directly. > > I could imagine an \F escape sequence with the following syntax: > > :'\F' printf-form

Re: printf-like formatting in interpolated strings

2003-06-15 Thread Edwin Steiner
Edwin Steiner <[EMAIL PROTECTED]> writes: > "Leave some --\Fs60{space for this $interpolates string}--." I'm sorry, this should be: > "Leave some --\F60s{space for this $interpolates string}--."

printf-like formatting in interpolated strings

2003-06-15 Thread Edwin Steiner
Hello! Recently I was coding Perl 5 and quite often I had to change interpolated strings or C to C or . I began to wonder, if qq strings couldn't allow sprintf-like formatting directly. I could imagine an \F escape sequence with the following syntax: :'\F' printf-format-without-% '(' expr