[dmd-internals] open dmd pull requests, oldest Feb 6, 2011
Michel Fortin
michel.fortin at michelf.com
Sun Mar 6 15:37:49 PST 2011
Le 2011-03-06 à 17:51, Benjamin Shropshire a écrit :
> On 03/06/2011 01:14 PM, Michel Fortin wrote:
>> Le 2011-03-06 à 14:10, Don Clugston a écrit :
>>
>>> OTOH I don't know what to about the const(Object) ref pull request.
>>> That will definitely take a long time to evaluate.
>> Indeed, and I don't expect it to be integrated as fast as a normal pull request. It's fine for a more complicated patch to take longer to review. Don't hesitate to merge smaller ones first even if mine is older. Still, I hope someone looks at it eventually.
>>
>> Also, this pull request is small relatively to what I'm preparing regarding integration of the Objective-C object model as extern(Objective-C). In a way you could say I'm testing the process with this smaller one first.
>
> Given that we now have three(?) extern(Foo)'s in play (if not in the official version), should the API of what an extern looks like be formalised? Might it even be done so that unofficial support for other languages could be implemented as SO/DLL's without needing to rebuild dmd
Great idea. Unfortunately, it can't be done with DMD as we have now. For one thing, DMD would need to represent different linkage with different classes which could be registered dynamically at runtime, currently it uses a simple enum for that.
But to give you an idea of what I'm doing inside DMD: I had to change the backend a little so it can emit special Objective-C-reserved segments with custom alignment, I had to change the parser to add a new keyword (__selector) and a syntax for specifying selectors and even to parse the "extern(Objective-C)" construct, I had to make strings literals implicitly convertible to Objective-C's NSString literals and made some other type implicitly convert to equivalents, I had to make 'static' functions virtual functions belonging to the Objective-C metaclass (whether I should have invented a new keyword for that is debatable), I had to create an implicit nested class named "Class" in each class representing the metaclass and to add the built-in property "this.class" to access the metaclass, I had to implement dynamic casts of Objective-C objects, and a few other ticks like that.
The result of my work is starting to take shape. I'm currently a little stuck with memory management and finding a way to declare categories, but overall it's already starting to become usable. I made my first Cocoa test application last week.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the dmd-internals
mailing list