C++ User-defined class qualifiers in D

Tejas notrealemail at gmail.com
Tue Aug 22 02:34:04 UTC 2023


On Saturday, 19 August 2023 at 19:56:54 UTC, Basile B. wrote:

> As note the author
>
>> A more interesting challenge is the following: As laid out, 
>> this technique implements syntactic qualifier subtyping, but 
>> does not do anything towards enforcing the semantics 
>> associated to each qualifier

The only way to enforce semantics for `C++` and `D` would be via 
creating a compiler plugin that enforces the semantics, I think.

The compiler can't perform the necessary semantics analysis if 
the logic for that is not present in it. The languages aren't 
even interpreted, such that the code to modify the behavior 
towards certain types/qualifiers could be presented on-the-fly 
and the interpreter/VM could adapt dynamically.


One can write C++ plugins, atleast for clang, using 
https://clang.llvm.org/docs/Tooling.html#clang-plugins

For D plugins, atleast for LDC, we most likely now have 
https://forum.dlang.org/post/clelngkqvihzybpxgldq@forum.dlang.org


More information about the Digitalmars-d mailing list