Vision
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 23 13:03:48 PDT 2015
On 2015-10-23 14:44, Steven Schveighoffer wrote:
> As an objective C developer on iOS, I am curious if you have done any
> true development using this?
No :). But I have done some development even without this, i.e. only
using the Objective-C runtime. Even though this might look small, it's a
huge improvement. I mean, you don't have to worry about the ABI.
> The example looks terrible -- objc_lookUpClass which only gets a class
> that can alloc an NSString? Can this be done better? An objective-c
> developer that is not too familiar with D would be very disappointed in
> this binding.
This is only the first step, the bare minimum that is useful. I had a
pull request which implement support for most of the Objective-C
features but was asked to split it up in smaller chunks. Remember that
the initial C++ support was even more lacking than this. It was not
possible to instantiate C++ classes from D.
This is the goal [1].
I'm pretty sure that it's possible to use some of the D features to
improve this.
> Also, what type does 'id' map to?
"id" in Objective-C is a bit weird since you can store both all object
types an also all regular C types. There is no type in D that
corresponds to that.
When working with the Objective-C runtime it is something like this:
alias Class = objc_class*
struct objc_class
{
Class isa;
}
alias id = objc_object*;
struct objc_object
{
Class isa;
}
[1] http://wiki.dlang.org/DIP43
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list