--- Comment #8 from deadalnix <> 2011-12-03 04:42:25 PST ---
(In reply to comment #7)
> The baseline of D type system is to disallow things that can't be guaranteed.
> C++ definitely can't guarantee any of the three.
> To avoid explicit casting at every caller place, you could add
> a D wrapper that does the calling.
> extern(C++) void _spawn(void function() fun, void* data);
> void spawn(extern(C++) void function() fun, shared void* data)
> {
>   _spawn(fun, cast(void*)data);
> }

This piece of code miss completely the point of the one before.

But back to the problem, obviously, C++ cannot guarantee, with it's type
system, that something is immutable, shared, or whatever. This is why a bindong
is required, and the same thing must be express the D way and the C++ way to

It is up to the person writting the binding to ensure that it is correct. C++
can have immutable data, or shared one's. It isn't guaranteed by the type
system, but can be guaranteed by the logic of the application. So it make sense
to express those in bindings.

C++ cannot guarantee anything that D guarantee. It can corrupt memory, share
non shared data across thread, etc . . . So if we agree on this argument,
extern(C++) must be simply and completely removed from D's specification and

When it comes to binding, it is up to the person writting the binding to ensure
that code on both sides express the same thing, and it cannot, and never will,
be enforced by a specification.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to