Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Motion to finalise interval literals



Jürgen, Vincent, P1788

> On 2013-06-07 20:02:05 +0200, Jürgen Wolff von Gudenberg wrote:
>> P1788
>> as already stated in one of my last emails, I think interval
>> literals should not be required. They will involve languages and
>> compilers, and ,hence, augment the workload in dissemination the of
>> standard.
>> 
>> so change the "shall" into a "should"
On reflection I disagree with this. Interval literals have nothing to do with any language -- unless it chooses to incorporate them into its syntax. They are the notation that interval2text() outputs, and text2interval() inputs. 

These are library functions. 
- interval2text() will standardise, for intervals, something like fprintf() in C, or formatted write() in Fortran. It should also (IMO) offer a default output of intervals like C's fprintf() with %g specifier, or cout in C++, or write(*,*) in Fortran.
- text2interval() is a basis for a standardised free-format input of intervals, on the lines of read(*,*) in Fortran.

Someone only needs to write a these *once*, probably in C. They will then probably be used by various languages & implementations. 

1788 doesn't propose, currently, to specify interval2text()'s conversion specifiers, so whoever does it first will probably make a de facto standard for those. Compare %f, %e, etc. in C's printf(), which is used with minor changes in about 30 widely used languages, says Wikipedia.

> On 13 Jun 2013, at 13:23, Vincent Lefevre wrote:
> A "literal" is a concept from programming languages. If the term
> "literal" is used in the standard, it should be synonymous to
> a text2interval argument, possibly with some language-defined
> transformations (e.g. a prefix and/or a suffix, character escape
> mechanisms...), in particular to avoid clashes with other parts
> of the language.

Fair point, but one must weigh the pros and cons of inventing a new word vs. re-using an existing one. "1788 interval literal" looks OK to me, on the lines of "754 format". Can you suggest a better term? Oh, and if it does just mean "a text2interval argument", how can clashes with other parts of a language occur?

John Pryce