Re: Fw: Motion 31 Suggestions
On 2012-01-24 16:51:29 -0500, Ian McIntosh wrote:
> I designed that (and others improved my design) before 1788, so it wasn't
> designed for intervals, but there are several ways it could be used for
> them. The brackets are an problem. One solution would be to require
> quoting, eg, "[1, 2.5]"interval. If the Interval class conversion
> operator allowed it, you could write syntax like "[0, oo)"interval. The
> class author or any user could of course define the name Entire to be the
> constant "[-oo, +oo]"interval. The interval for a floating point value
> could potentially be written 12_interval or 12.345_interval, which would be
> converted into the singleton [12, 12] and the non-singleton [12.345 rounded
> down, 12.345 rounded up].
How about something like 1_to_2.5_interval to express [1,2.5]
for instance?
> User defined literals define a function (or functions) to convert some
> sequence of characters in a program that meet some defined syntax
> representing a literal into the corresponding internal constant of the
> specified type. The constant is not a function, but the conversion from
> its external form to its internal form is defined by a function. It is
> internally represented the same way a variable is and generally treated the
> same way a variable is, except that it is not allowed to be changed. Maybe
> 1788 could use that approach, instead of defining constants as functions?
The way I see the P1788 text is that constants are regarded as
functions for the spec, but it is up to the language to decide
how they are handled.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)