D/Objective-C, extern (Objective-C)
Jacob Carlborg
doob at me.com
Mon Jun 24 13:30:56 PDT 2013
On 2013-06-24 15:27, Michel Fortin wrote:
> Not necessarily. There's a couple of Objective-C classes that get
> special treatment by the compiler (identified by a pragma). One could do
> the same for an UDA so the compiler would know where to get that value.
> I'd surely have implemented it as an UDA if such a thing existed at the
> time.
The thing is that pragmas are tied to the compiler. It knows the
difference between pragma(foo) and pragma(bar). But for UDA's they are
all treated the same, there's no difference between @(3), @("asd") and
@foo from the compiler's point of view (as far as I understand). You
could implement it as a new attribute (that is, not an UDA), but to
implement it as an UDA would be a totally new thing.
> I'm particularly proud of those string literals. They're way cleaner
> than their Objective-C counterparts. :-)
I agree.
> Those too are better than their Objective-C counterpart too as they
> carry the argument and return type, making them less error-prone.
Same thing here.
> Blocks are reference-counted and don't share the two-pointer layout of a
> delegate. I'm not sure it'd be wise to call them delegates. But this
> needs some more thinking.
Right, they seem kind of complicated in regards of the struct layout
it's implemented as. Seems to vary quite much depending on how the block
is used and how outer variables are referenced.
> Finally, there is a couple of features that were added to Objective-C
> since then that should be added to the todo list to keep feature parity.
> Some of those, if implemented right, could benefit the rest of D too.
> For instance: ARC (automatic reference counting) which is becoming a
> must in Objective-C.
Yes. There are a couple of new features that D can take advantage of
without adding new language support. I'm thinking of the simplified
operator overloading that was added, last year I think. We already have
operator overloading and can add that to the bindings, no need for
language support.
If we want to add support for the new literals (numbers, arrays and
associative arrays) we could do the same thing as we already done for
strings.
And last, modules that was added this year, D has had that for years :)
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list