Re: Weaken disjointness of range type?
Marc Nieper-Wißkirchen 06 Sep 2020 07:35 UTC
Am So., 6. Sept. 2020 um 01:35 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
>> Particular implementations can give you the guarantee, or a future SRFI. At the moment, nothing would change but enabling potential future guarantees.
> What ranges (as currently specified) do provide is a guarantee of immutability by construction: there is no way to even attempt to mutate them. Literal vectors provide no such negative guarantee. You can attempt to mutate them: the action may succeed (as is the case in about half of all current Schemes), may raise an exception, or may make demons fly out of your nose. The distinction between it-is-an-error immutability and by-construction immutability is something I wish to preserve.
Agreed; this should not be weakened for ranges. The question is, how
to formulate this in technical terms. Just by saying, it is an error
to mutate a range does not help. So what about adding the following:
"Ranges do not denote locations. So, in particular, as much as it is
impossible to mutate a Scheme number, it is impossible to mutate a
range. For more about locations and mutability, see section 3.4 of the
R7RS on the Scheme storage model."
(Such wording makes sense with or without the addition that would
allow an implementation not to expose the difference between a vector
and a range to the user.)