Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Alex Crichton
Thanks for all the comments everyone! I'll see if I can address a good number of them here: > - I don't see how the example {:date} is generated from the grammar. > Though I do think custom (especially culture-specific) formatter > functions do need some support. Money and dates are the big tw

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Graydon Hoare
On 13-07-29 02:41 AM, Steven Ashley wrote: Apologies. This was exactly the use case I was trying to convey. Unfortunately I was writing the email from my phone while on the run and couldn't recall the specifics of the syntax. I should have indicated it was pseudo code of sorts. Oh, no worries

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Steven Ashley
On 29/07/2013 6:36 AM, "Graydon Hoare" wrote: > > On 13-07-28 04:06 PM, Steven Ashley wrote: > >> {0:( >>if count == 0 then (You have no messages.) >>else (You have {count:#} messages.) >> )} > > > That's exactly the case that the nested pluralization forms are for. Read the docs on Me

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Masklinn
On 2013-07-29, at 11:04 , Huon Wilson wrote: > On 29/07/13 18:26, Masklinn wrote: >> I don't have much to say, but >> >> On 2013-07-29, at 06:24 , Alex Crichton wrote: >>> * Any argument can be selected (0-indexed from the start) >> keyword/named selection is *really* great for longer/more busy

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Armin Ronacher
Hi, On 29/07/2013 06:24, Alex Crichton wrote: Having thought a bit more concretely about this, using the suggestions here, and talking to Graydon on IRC I've come up with the following design for a string formatting library. I think that this addresses the comments in the responses to my origina

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Huon Wilson
On 29/07/13 18:26, Masklinn wrote: I don't have much to say, but On 2013-07-29, at 06:24 , Alex Crichton wrote: * Any argument can be selected (0-indexed from the start) keyword/named selection is *really* great for longer/more busy patterns, it makes format string much more readable both in

Re: [rust-dev] Redesigning fmt!

2013-07-29 Thread Masklinn
I don't have much to say, but On 2013-07-29, at 06:24 , Alex Crichton wrote: > > * Any argument can be selected (0-indexed from the start) keyword/named selection is *really* great for longer/more busy patterns, it makes format string much more readable both in-code and for translators (who usu

Re: [rust-dev] Redesigning fmt!

2013-07-28 Thread Graydon Hoare
On 13-07-28 09:24 PM, Alex Crichton wrote: I would love comments/suggestions on this system. I think that this takes into account almost all of the feedback which I've received about how formatting strings should work, but extra sets of eyes are always useful! In general I'm really happy you'r

Re: [rust-dev] Redesigning fmt!

2013-07-28 Thread Graydon Hoare
On 13-07-28 04:06 PM, Steven Ashley wrote: {0:( if count == 0 then (You have no messages.) else (You have {count:#} messages.) )} That's exactly the case that the nested pluralization forms are for. Read the docs on MessageFormat. They've been working on this problem space for quit

Re: [rust-dev] Redesigning fmt!

2013-07-28 Thread Alex Crichton
Having thought a bit more concretely about this, using the suggestions here, and talking to Graydon on IRC I've come up with the following design for a string formatting library. I think that this addresses the comments in the responses to my original email, but if not please let me know! == Forma

[rust-dev] Redesigning fmt!

2013-07-28 Thread Steven Ashley
On Sunday, July 28, 2013, Brian Anderson wrote: > > I'm not a fan of printf-style format specifiers in general, largely > because the specifiers have to be allocated in some way (fmt attribute) so > are not particularly extensible. I can't imagine how this fmt attribute can > be implemented in a ge

Re: [rust-dev] Redesigning fmt!

2013-07-28 Thread Brian Anderson
On 07/26/2013 11:37 PM, Alex Crichton wrote: I recently looked into redesigning fmt!, and I wanted to post my ideas before going all the way to ensure that I'm not missing out on anything. Another thing that needs to be considered is how format modifiers (things like significant digits etc. in

Re: [rust-dev] Redesigning fmt!

2013-07-28 Thread Brian Anderson
On 07/26/2013 11:37 PM, Alex Crichton wrote: I recently looked into redesigning fmt!, and I wanted to post my ideas before going all the way to ensure that I'm not missing out on anything. Fabulous. There's a number of related info in #2249 and sub-bugs. Other designs have been floated for thi

[rust-dev] Redesigning fmt!

2013-07-26 Thread Alex Crichton
I recently looked into redesigning fmt!, and I wanted to post my ideas before going all the way to ensure that I'm not missing out on anything. == Today's state == As of today, fmt! works pretty well. It's a very useful function and will likely be a very common thing in all rust code using libstd