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

Re: P1788 input/output



Vincent Lefèvre replied to my note on intervalTo Recoverable():
> The primary goal of recovery is to use the same type.  Then there's the
> question of whether you want to allow exact2interval to be applied on a
> different type.  If yes, then I agree that one needs to require an exact
> representation.  For instance, if exact2interval is applied on a different
> type, it shall either return an exact result or raise a language- or
> implementation-defined exception.

This is possible only if the recoverable representation includes type
information.  And the issue of deliberate containment violation in one
or the other direction remains:  warnings about mis-use would be needed.
One way would be for the type encoding to be such that the result is
syntactically invalid for textToInterval(), so that it can be read back
successfully only through recoverableToInterval() to a matching format,
as Vincent suggested above (but I would not call it "exactToInterval()").

The nice thing about intervalToExact() is that its result can be read
back by regular textToInterval(), recovering the original type exactly,
but preserving containment in all cases, in and out.  There is no need
for extra information.

I have no problem permitting small integers to be expressed in decimal,
but large integers benefit from exponential notation in the proper radix.

Michel.
---Sent: 2013-07-23 11:06:21 UTC