IDL
Difference (last change) (no other diffs, normal page display)
Changed: 1c1,49
Describe the new page here. |
This page is under heavy construction, as I am writing this as I digest the XML DOM specification. All are encouraged to contribute. - EricAnderton =What is IDL?= The Interface Description Language is used all over the computer science landscape, especially when concepts are described in a language-neutral way. It is also used directly by some languages and compilers as a means of describing an interface with an external system (like in CORBA). One can describe a binary interface for two systems, written in completely different languages, in IDL and expect them to inter-operate. =Converting from IDL to D= So you want to implement an IDL module or interface in D? The process is actually very straightforward, and can be done about 90% via search-and-replace. At first glance, IDL looks a lot like D. IDL has support for typedefs and interfaces, and even predefined Object and Exception types. IDL has several attributes that D doesn't have. Coping with these differences usually means altering your interfaces slightly to adopt the behavior specified in the IDL version. * readonly attribute - Read-only attributes can be best emulated via D's 'property method' technique. * raises(exceptionname) - There is no equivalent for this in D, so just throw it out. You may want to include this bit in your documentation for use later. The basic data types in IDL share some of the same names in D. The most confusing of these is "long", which is the samea as an "int" in D. The rest are fairly straightforward.* [[table] IDL, D, width void, void, NA (return-type only) boolean, ???, ??? ???,byte, signed 8 bits ????,ubyte, unsigned 8 bits short,short, signed 16 bits unsigned short,ushort, unsigned 16 bits long,int, signed 32 bits unsigned long,uint, unsigned 32 bits long long, long, signed 64 bits unsigned long long,ulong, unsigned 64 bits ???,float, 32 bit floating point ???,double, 64 bit floating point ???,char, unsigned 8 bit UTF-8 ???,wchar, unsigned 16 bit UTF-16 ???,dchar, unsigned 32 bit UTF-32 ] There are no IDL equivalents for the bit, complex, imaginary, real or cent datatypes. Pointers are also not supported in IDL. =Links= Wikipedia: IDL - ![]() Example: W3C? XML DOM IDL - ![]() =Footnotes= (*) some programmers may recognize this matrix from C/C++ to D type conversions, which are largely the same |
This page is under heavy construction, as I am writing this as I digest the XML DOM specification. All are encouraged to contribute. - EricAnderton
What is IDL?
The Interface Description Language is used all over the computer science landscape, especially when concepts are described in a language-neutral way. It is also used directly by some languages and compilers as a means of describing an interface with an external system (like in CORBA). One can describe a binary interface for two systems, written in completely different languages, in IDL and expect them to inter-operate.
Converting from IDL to D
So you want to implement an IDL module or interface in D? The process is actually very straightforward, and can be done about 90% via search-and-replace.
At first glance, IDL looks a lot like D. IDL has support for typedefs and interfaces, and even predefined Object and Exception types.
IDL has several attributes that D doesn't have. Coping with these differences usually means altering your interfaces slightly to adopt the behavior specified in the IDL version.
- readonly attribute - Read-only attributes can be best emulated via D's 'property method' technique.
- raises(exceptionname) - There is no equivalent for this in D, so just throw it out. You may want to include this bit in your documentation for use later.
|
There are no IDL equivalents for the bit, complex, imaginary, real or cent datatypes. Pointers are also not supported in IDL.
Links
Wikipedia: IDL - http://en.wikipedia.org/wiki/Interface_description_language
Example: W3C? XML DOM IDL -
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl/dom.idl
Footnotes
(*) some programmers may recognize this matrix from C/C++ to D type conversions, which are largely the same