How to include Python Modules in a D Program?

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Sep 24 17:04:30 PDT 2007


"Jon" <SchaduwBlink at hotmail.com> wrote in message 
news:fd9inf$2voj$1 at digitalmars.com...
> It sounds like either way is not that easy. -_- There wouldn't be a python 
> to D convertor anywhere would there? Something like the .h to .d 
> convertor?
>

No offense, but apples to oranges.  Converting a C header file to D is 
mostly a mechanical process -- there is (usually) no actual code to convert, 
just function and type declarations.  D is also (almost) a superset of C, 
meaning that semantically there's not much difference between C and D code.

Automatic translation of a language such as Python to D would be an 
incredibly complex undertaking.  Think writing a Python to native code 
compiler which preserved all the language semantics at runtime -- that's 
basically what you'd be doing, although not all the way to machine code, 
just to D code.  The languages are just too different for one to be 
converted to the other.  This is why Pyrex exists.  Probably about the 
closest you could _practically_ get would be something like Pyrex that 
outputted D code instead of C code. 




More information about the Digitalmars-d-learn mailing list