[rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-03 Thread Huon Wilson
Hi all, Aatch, Kimundi and I (and maybe some others... sorry if I've forgotten you) came up with a bit of proposal on IRC for handling fmt!. It's possibly been considered already, but whatever, we'd like some comments on it. There would one trait for each format specifier (probably excluding `?

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-03 Thread Brian Anderson
On 05/03/2013 08:28 AM, Huon Wilson wrote: Hi all, Aatch, Kimundi and I (and maybe some others... sorry if I've forgotten you) came up with a bit of proposal on IRC for handling fmt!. It's possibly been considered already, but whatever, we'd like some comments on it. I'm glad you are thinking

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-03 Thread Graydon Hoare
On 13-05-03 01:12 PM, Brian Anderson wrote: I agree with reconsidering the inconsistent, underspecified printf syntax, but don't have any specific thoughts on this at this time. Note that I made a page collecting links to existing format libraries a little while back: https://github.com/moz

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-03 Thread Graydon Hoare
On 13-05-03 01:21 PM, Graydon Hoare wrote: On 13-05-03 01:12 PM, Brian Anderson wrote: I agree with reconsidering the inconsistent, underspecified printf syntax, but don't have any specific thoughts on this at this time. Note that I made a page collecting links to existing format libraries a

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-04 Thread Mikhail Zabaluev
Hi, 2013/5/3 Graydon Hoare > > (Erm, it might also be worthwhile to consider message catalogues and > locale-facets at this point; the two are closely related. We do not have a > library page on that topic yet, but ought to. Or include it in the lib-fmt > page.) If you are talking about gettex

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-04 Thread James Miller
On 2013-05-04 01:28:43, Huon Wilson wrote: > Hi all, > > Aatch, Kimundi and I (and maybe some others... sorry if I've forgotten > you) came up with a bit of proposal on IRC for handling fmt!. It's > possibly been considered already, but whatever, we'd like some > comments on it. > > > There woul

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-06 Thread Graydon Hoare
On 13-05-04 12:31 AM, Mikhail Zabaluev wrote: > If you are talking about gettext-like functionality, usually this and > format strings are thought of as independent processing layers: format > strings are translated as such and then fed to the formatting function. > This brings some ramifications,

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-07 Thread Mikhail Zabaluev
Hi Graydon, 2013/5/6 Graydon Hoare > > Yes, this is the sort of thing I was thinking of: that there are some > pressures that a gettext() layer feed back to the selection of > formatting strings that might be worth considering. > > Also that it might be nice to make fmt!() default-to, or very ea

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-08 Thread Graydon Hoare
On 13-05-07 09:49 AM, Mikhail Zabaluev wrote: > What do you think of using Rust lambdas for context-sensitive > translations? That could easily accommodate any sort of variance, and > would not complicate the fmt! syntax (though it would require another > fmt-like macro to substitute, as well as m

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-09 Thread Matthieu Monrocq
On Thu, May 9, 2013 at 12:11 AM, Graydon Hoare wrote: > On 13-05-07 09:49 AM, Mikhail Zabaluev wrote: > > > What do you think of using Rust lambdas for context-sensitive > > translations? That could easily accommodate any sort of variance, and > > would not complicate the fmt! syntax (though it w

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-09 Thread Olivier Renaud
As for that library, I heavily suggest letting translators manipulate Rust code directly. I see it as no more difficult than asking them to learn a special micro-language that keeps evolving and pattern-matching is really adapted for the task at hand. I'd like to react to this. If the translator

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-09 Thread Graydon Hoare
On 13-05-09 04:26 AM, Matthieu Monrocq wrote: > However, I am not too sure about the idea of string -> string mapping. > The example you give here is actually slightly more complicated because > there are several orthogonal axes: Hm. I think you're missing what I mean. I mean that the interface -

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-09 Thread Mikhail Zabaluev
Hi, 2013/5/10 Graydon Hoare > > - Any expression of that conditional logic is going to be ugly, > but it is actually required for the translator to give an > accurate translation. > I agree. And if expressions are in Rust, you get the benefit of a Rust compiler validating them. A lamb

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-09 Thread Tim Chevalier
On Thu, May 9, 2013 at 10:49 PM, Mikhail Zabaluev wrote: > My favorite real world example is "%s has joined the chat room." The gender > may be unknown (they didn't say in their user profile), female, male, and if > you are really thorough and provide for non-human chat participants, > neutral. A

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-10 Thread Mikhail Zabaluev
Hi, 2013/5/10 Tim Chevalier > On Thu, May 9, 2013 at 10:49 PM, Mikhail Zabaluev > wrote: > > My favorite real world example is "%s has joined the chat room." The > gender > > may be unknown (they didn't say in their user profile), female, male, > and if > > you are really thorough and provide f

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-10 Thread Lucian Branescu
On 9 May 2013 12:26, Matthieu Monrocq wrote: > My point is, therefore, that even a seemingly innocent looking sentence > like this one actually turns into a monster: > > "{0} {1, select, singular {{2, select, female {est allée} other {est > allé}}}, other {{2, select, female {sont allées} other

Re: [rust-dev] RFC: User-implementable format specifiers w/ compile-time checks

2013-05-10 Thread Graydon Hoare
On 13-05-09 10:49 PM, Mikhail Zabaluev wrote: > I agree. And if expressions are in Rust, you get the benefit of a Rust > compiler validating them. A lambda must produce _some_ string to be > valid; match clauses will be checked for correct type and coverage. > Dynamically interpreted syntax engine