Head Const

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 17 14:01:45 PST 2016


On 2/17/2016 4:03 AM, Jakob Ovrum wrote:
> How about disallowing immutable data with extern(C++) types? With extern(C++)
> data always mutable, `const` could safely be reused to mean C++ const in
> bindings. Any `mutable`-style code would be implemented in C++.

That doesn't help with trying to match the mangling for:

    mutable pointer to const pointer to mutable pointer to const pointer to 
mutable pointer to void

It's still an interesting idea, but it would precluded passing any D immutable 
data structures to C++ code. I tend to think such needs to be possible, with the 
proviso that you'd have to verify that the C++ end did not violate the 
immutability rules. It's normal practice to write C++ code as if const were 
transitive.



More information about the Digitalmars-d mailing list