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

via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 25 14:14:01 PDT 2014


On Monday, 25 August 2014 at 19:26:59 UTC, Brost wrote:
> 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 .

Ok, but formally a protocol is just a structured technique for 
exchange between entities.

So the D protocol is the means to obtain typeinfo at compile 
time. Then you can translate the "D typeinfo protocol" into 
another protocol of your own choice?

It seems to me that all you need is a list of types you want to 
export. From this you should be able to write your own protocol 
by annotating members you want to export with user defined 
attributes?

http://dlang.org/expression.html#typeidexpression
http://dlang.org/phobos/object.html#.TypeInfo
http://dlang.org/phobos/object.html#.OffsetTypeInfo
http://dlang.org/traits.html#allMembers
http://dlang.org/traits.html#getMember
http://dlang.org/traits.html#getAttributes
…

Seems to be a workable solution to me.

Ola.


More information about the Digitalmars-d mailing list