D/Objective-C 64bit

Jacob Carlborg via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Nov 4 23:25:00 PST 2014


On 2014-11-04 13:29, Christian Schneider wrote:
> what is funky in this context (see above): even when using
> ObjcObject in both the mapping and the action method, the test
>
> if (sender is demoTableView) {
>      //
> }
>
> does not fail in the action

That will just compare the address of the objects.

> , only a cast to a NSTableView object
> fails. Of course, in this setting it's not really a problem, I
> can work directly on the demoTableView member and can forget
> about the sender, but this is against how I would do it in
> Objective-C where I can always cast an id reference to the
> expected type.

See the reply by Michel. It's probably a bug/oversight in the compiler. 
As a workaround you can, as you said, use NSObject instead of ObjcObject 
in both places.

What happens if you declare "doubleClickAction" like this:

void doubleClickAction(NSTableView sender) { ... }

That will probably require a cast when passing the selector to 
"setDoubleAction".

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list