The CAPI Manifesto

Ary Manzana ary at esperanto.org.ar
Sun Oct 16 19:18:42 PDT 2011


On 10/16/11 11:02 PM, Walter Bright wrote:
> Brad and I were talking about some D code that needed openssl support,
> when we ran into the same old problem:
>
> No D files corresponding to the openssl C .h files.
>
> It's not that these are a big problem to create, it's just that they are
> not done, and it tends to turn off people from using D. D is binary API
> compatible with C, but only with a corresponding D import file. This,
> out of the box, makes D *harder* to use than C.
>
> Lots of people roll their own, but that work is hard to find and haphazard.
>
> This problem keeps coming up again and again.
>
> So I propose creating, on github.com/D-Programming-Language, a new
> repository called CAPI.

So you would put every interface to every possible C code there?

In Ruby if you want to have very efficient code you'd implement it as C 
extensions. For that, you create wrappers in Ruby for C. Now, big part 
of the standard library has extensions for the most needed things. 
Everything else, like bindings to an efficient xml parser, are made by 
different people that public them as gems. Having a public gem 
repository it's really easy to find bindings for whatever you want. They 
don't need to be part of the standard library. And it wouldn't make 
sense, having so much functionality out there available as C code.

So I'd suggest having D headers for the most common things in phobos and 
focusing on a tool like rubygems. It would give such a big boost to the 
language.

I also can't imagine how that big repository would work. You'd copy the 
remote file locally? What if that file gets fixes? You'd copy it again? 
Or maybe you'd git checkout everything from that repository locally and 
synchronize it from time to time, with the chance of breaking existing 
code...

Having "gems" and versioning them should make all these problems 
disappear. Maybe there is an openssl header in D. The problem is that 
there might be many, and they don't know each other, and google is a 
maze to find such things.


More information about the Digitalmars-d mailing list