Store mutable indirections in immutable data with this one weird trick!
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun Nov 14 10:47:34 UTC 2021
On Sunday, 14 November 2021 at 10:32:14 UTC, Dukc wrote:
> In `@safe` code with only the language constructs, that is. You
> could still write sound `@trusted pure` library functions that
> can do those in efficient way.
Yes, but this is where things are starting to get hazy. Can we
convince ourselves that various combinations of ```@trusted
pure``` ensure that object identity does not become a dependency?
Do we know whether it is easy to ensure this when writing custom
library types? I don't know…
Maybe there is a methodology (design technique) that can be made
explicit, but this is where mere arguments don't convince. We
have to set up the rules that has to be followed and analyse them.
I think explicit rules for programmers to be followed are needed,
in general, for a system level language that both wants to have a
higher level type system, and also want to provide "assumption
mechanisms" like ```@trusted```.
Of course, system level programming should also give the
programmer freedom to customize the runtime, like being able to
restart threads on failure etc. So there might be good reasons to
bend the rules of "pure". That is an extra layer of trickiness
that I think often is forgotten in D discusssions. Often
arguments are made as if D is a proper higher level language
(more abstract).
More information about the Digitalmars-d
mailing list