Thread Links | Date Links | ||||
---|---|---|---|---|---|
Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
VL> How about something like 1_to_2.5_interval to express [1,2.5]
VL> for instance?
I'll have to check the final wording in the standard to see if a User Defined Literal conversion operator could accept literal syntax like 1_to_2.5_interval. A literal has to either start with a digit or be in quotes, and obviously it has to end with the specified suffix. A separate new feature allows "_" in numeric literals. The problematic part is the "to". 1___2.5_interval should be OK. The quoted literal "1_to_2.5"interval should be OK.
IM>> ... The constant is not a function, but the conversion from
IM>> its external form to its internal form is defined by a function. It is
IM>> internally represented the same way a variable is and generally treated the
IM>> same way a variable is, except that it is not allowed to be changed. Maybe
IM>> 1788 could use that approach, instead of defining constants as functions?
VL> The way I see the P1788 text is that constants are regarded as
VL> functions for the spec, but it is up to the language to decide
VL> how they are handled.
Yes, 1788 can defined constants as functions and languages can define them as not functions.
I spend my time dealing with programs, programming languages and their implementation, not with mathematics. I find treating constants as functions counterintuitive and think it introduces unneeded complexity to the standard, since every place it mentions functions we have to think about whether that part of the wording is exactly correct for constants. For example, while an implementation can have a library that includes all non-constant functions defined by the standard, it cannot realistically have a library that includes all 2^128-1 constants (assuming binary128). It makes more sense to me to treat constants differently from functions. We do in real life.
Here's how I'd define it:
Interval "operations" and "functions" deal with (consume and/or produce) interval "values". Some values are calculated; others are "constants". Some constants are "named constants" which represent specific interval values (eg, Entire defined by 1788 represents [-oo,+oo]); others are numeric and are converted from text to interval values by "constant conversion functions". Both named constants and constant conversion functions may be defined by 1788 and/or programming languages/environments/applications and/or users. The 1788 constraints on constant (and other) conversion functions are that (1) they must either produce a valid interval or in some way report an error and (2) they must not violate containment of the value represented by a reasonable interpretation of the text.
I hope we don't have to define a "reasonable interpretation of the text" in the standard. If you like the semantics, I expect you can significantly improve my wording.
- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development
Vincent Lefevre ---01/26/2012 07:49:08 AM---On 2012-01-24 16:51:29 -0500, Ian McIntosh wrote: > I designed that (and others improved my design)
![]() From: | ![]() Vincent Lefevre <vincent@xxxxxxxxxx> |
![]() To: | ![]() Ian McIntosh/Toronto/IBM@IBMCA |
![]() Date: | ![]() 01/26/2012 07:49 AM |
![]() Subject: | ![]() Re: Fw: Motion 31 Suggestions |