Store mutable indirections in immutable data with this one weird trick!
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sat Nov 13 18:06:37 UTC 2021
On Saturday, 13 November 2021 at 15:16:43 UTC, Paul Backus wrote:
> What you do is have the compiler enforce the preconditions
> necessary to make its assumptions hold. So, if the result of a
> `pure` function is not supposed to depend on the specific
> values of any pointers, `pure` functions should be forbidden
> from comparing pointers, casting them to integers, or
> performing any other operations that might introduce such a
> dependency.
That would undermine performance and render pure even more
useless than it already is.
> Or, alternatively, if that's too much trouble, you recognize
> that the assumption underlying this optimization is invalid,
> and you remove it from the compiler and the language spec.
> (Which I expect is what will happen in practice, sooner or
> later.)
Just remove the notion of normative "strongly pure", it is a big
mistake to split a concept based on the input typing. Confusing
two concepts like this in one construct is making the language
more complex than keeping the concepts separate. It is ugly. Keep
it clean, keep semantics of each concept simple.
More information about the Digitalmars-d
mailing list