On 2014-03-12 08:06:47 +0000, "w0rp" <devw...@gmail.com> said:
This is really awesome work. If you combined ARM support with Objective
C support, it would mean you could write iOS programs in D without much
frustration, and that would be a huge step forward. Objective C has a
good runtime, but lacks templates and CTFE. Using CTFE for an iOS
program could be very cool.
How do you plan to handle automatic reference counting? I imagine
that's a hard part. When I was writing Objective C I remember having to
write bridged casts so I could manually extend or limit object
lifetime, but I never handled it from within a C library.
Well, there's three ways.
(a) The first one is to implement ARC for Objective-C objects, and to
automatically add/remove roots to member variables when
constructing/destroying Objective-C objects that were defined in D so
the GC can those pointers.
(b) The second one is to not implement ARC and implement something in
the GC so it can track Objective-C objects: retain them on first sight,
release them once no longer connected to a root.
(c) The third one is to implement ARC as an alternative memory
management scheme for D and bolt Objective-C object support on top of
I'd tend to go for (a) at first, as it's the simplest thing that can be
done. But I fear always adding/removing roots will impact performance
in a negative way. There's also the issue in (a) and (b) that if the
last reference to an object is released from the GC thread the
Objective-C object's destructor will be called in a different thread
than what is expected which might cause some bugs. So we might want to
implement (c) later on to have something more solid and deterministic.