How D addresses the problem of Extending and/or Embedding other languages ?

Xavier Bigand via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 3 16:01:13 PDT 2014


Le 25/08/2014 09:18, Brost a écrit :
> On Monday, 25 August 2014 at 06:44:25 UTC, Jacob Carlborg wrote:
>> On 25/08/14 08:18, Brost wrote:
>>
>>> Is D different in this regard ?
>>
>> In addition to being ABI compatible with C, D is also compatible with
>> C++ [1]. D recently got support for C++ templates and namespaces.
>> Hopefully it will get support for Objective-C as well, in the not too
>> far away future.
>>
>> [1] http://dlang.org/cpp_interface.html
>
> thanks, but unfortunately neither of those is a scripting
> language, I can't see any facility in the standard D library or
> in the language that can help me retain the type safety, the
> memory management, and all the other things I talked about while
> interfacing with another language .
>

You just can't introduce type safety to a scripting language without 
modifying the VM implementation, you may search if there is some fork of 
the library doing that.


> for example how do you correctly expose a given D data structure
> to a scripting language of your choice ?

In DQuick we expose D object to the Lua VM by using the Lua C library.
Its API allow us to expose D structures or classes directly.

If the API of the VM of your scripting language is written in C, it's 
almost the same as if you write a C++ application.



More information about the Digitalmars-d mailing list