I can't think of something with significant market share, but there is now an indie game on Steam written in D: Mayhem Intergalactic
Additionally, D is link-compatible with C. Using C libraries from D is as easy as porting the header files to D. There are a couple of tools for (mostly) automating this process, and quite a lot of the major C libraries have D bindings available.
There's no way that I can see to do this automatically.
The concern is this (reposted here so people don't have to dig through Pyd's docs):
class Foo { void bar() { writefln("Foo.bar"); } }
void func(Foo f) { f.bar(); }
When we wrap this class and this function with Pyd (or Boost.Python), we can subclass Foo with a Python class:
class PyClass(Foo): def bar(self): print "PyClass.bar"
The behavior we want is:
>>> o = PyClass() >>> func(o) PyClass.bar
However, there's no way to get the D function to polymorphically call the Python subclass's method without user intervention. I cannot generate the required wrapper with templates alone. Therefore, users must write thin wrapper classes in D, and expose the wrappers to Python:
get_overload performs a bit of magic, checking if the current object is an actual instance of FooWrap or a Python subclass, and calling the proper method as appropriate.
In the dim and distant future, I may be able to generate code like this in a SWIG-like fashion. D is remarkably easy to parse (perhaps one of the language's strongest advantages over C++), and I have almost completed a D parser written in Python (using Pyparsing). Since Pyd's build utility is written in Python, doing this kind of trickery shouldn't prove too difficult.
One area I see D being useful in is integration with Python. Writing to the raw Python/C API is cumbersome. (Managing reference counts is tedious.) Boost.Python is difficult to build and slow to compile. I've written a library for D called Pyd, whose purpose is not entirely unlike Boost.Python's.
Pyd is easy to use. It provides its own extension to Python's distutils. Usually, you just need to make sure the D compiler is on your PATH, write a setup.py file, and run python setup.py build.
"Hello world" in Pyd looks something like this (and I apologize for the lack of indentation):
I can't think of something with significant market share, but there is now an indie game on Steam written in D: Mayhem Intergalactic
Additionally, D is link-compatible with C. Using C libraries from D is as easy as porting the header files to D. There are a couple of tools for (mostly) automating this process, and quite a lot of the major C libraries have D bindings available.
There's no way that I can see to do this automatically.
The concern is this (reposted here so people don't have to dig through Pyd's docs):
class Foo {
void bar() { writefln("Foo.bar"); }
}
void func(Foo f) { f.bar(); }
When we wrap this class and this function with Pyd (or Boost.Python), we can subclass Foo with a Python class:
class PyClass(Foo):
def bar(self):
print "PyClass.bar"
The behavior we want is:
>>> o = PyClass()
>>> func(o)
PyClass.bar
However, there's no way to get the D function to polymorphically call the Python subclass's method without user intervention. I cannot generate the required wrapper with templates alone. Therefore, users must write thin wrapper classes in D, and expose the wrappers to Python:
class FooWrap : Foo {
mixin OverloadShim;
void bar() {
get_overload(&super.bar, "bar");
}
}
get_overload performs a bit of magic, checking if the current object is an actual instance of FooWrap or a Python subclass, and calling the proper method as appropriate.
In the dim and distant future, I may be able to generate code like this in a SWIG-like fashion. D is remarkably easy to parse (perhaps one of the language's strongest advantages over C++), and I have almost completed a D parser written in Python (using Pyparsing). Since Pyd's build utility is written in Python, doing this kind of trickery shouldn't prove too difficult.
One area I see D being useful in is integration with Python. Writing to the raw Python/C API is cumbersome. (Managing reference counts is tedious.) Boost.Python is difficult to build and slow to compile. I've written a library for D called Pyd, whose purpose is not entirely unlike Boost.Python's.
Pyd is easy to use. It provides its own extension to Python's distutils. Usually, you just need to make sure the D compiler is on your PATH, write a setup.py file, and run python setup.py build.
"Hello world" in Pyd looks something like this (and I apologize for the lack of indentation):