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

Brost via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 25 12:26:58 PDT 2014


It's really strange the fact that no one seems to feel about this
the same way I do, I mean you are happy with a C based bridge
between 2 languages, you are ok at throwing away all the good
stuff that both languages ( your X and your Y ) are offering ?

Thank you for posting various scripts and libraries but this is
not my point, I think that the game changer will be some kind of
support for this extensions and foreign languages built right
into the language itself.

Being ABI compatible it's not exactly like saying " I'm taking
all the invariants and features of D, translating your code in C,
and keeping everything functional and trustable just as it was in
D "

On Monday, 25 August 2014 at 07:37:28 UTC, Ola Fosheim Gr wrote:
> On Monday, 25 August 2014 at 07:18:51 UTC, Brost wrote:
>> 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 .
>>
>> for example how do you correctly expose a given D data 
>> structure
>> to a scripting language of your choice ?
>
> Wouldn't that depend on the scripting language? But you can 
> control layout of structs and might be able to print out other 
> information you need using reflection, so you might be able to 
> create the stubs you need using traits and properties?
>
> The gc accepts foreign root pointers, but the gc itself might 
> be too slow. So you would rather use v8s gc and @nogc in D?

Indeed you can't, but when you have to deal with structures that
you don't know nothing about before hand, and you have to inspect
the properties of something that I'm passing to you, usually at
this point some kind of protocol kicks in.

Protocols are basically the way to "standardize" or describe
something that can be implemented in many different way; I know
that if you start from the ABI or the compiled object you are
basically going nowhere because you are focusing on
implementation specific details and limitations.
That's what I was expecting, something like a protocol .


More information about the Digitalmars-d mailing list