Will D always have a way to rebind an arbitrary data type?

FeepingCreature feepingcreature at gmail.com
Mon Sep 20 08:43:48 UTC 2021


I'm trying to get a utility type `HeadMutable` merged in an 
internal utility library,
and one of the points of criticism in review is that the 
mechanism I'm using (Turducken, if you remember 
https://forum.dlang.org/thread/ekbxqxhnttihkoszzvxl@forum.dlang.org ) is extremely hacky; even though all parts of it are probably technically deliberately added to the language, it seems they add up to a pretty evil backdoor in the type system.

Anyway, it's not a problem if this specific (semi-intentional?) 
"loophole" gets closed. What we're worried about is ending up in 
a state where this idiom is not expressible in the language *at 
all*.

So my question, are the language developers willing to commit to 
the following statement?

"There will always be a way in D to write a `@nogc` container 
type with two operations: `put(T)` and `T get()`, so that the 
result value of `get` is value identical to the parameter of 
`put`, *for any arbitrary `T`,* especially value-immutable T, 
with correct lifetime accounting of the stored value."


More information about the Digitalmars-d mailing list