Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining handleUnknownMessage:withContext: on NSObject does not make it work on all NSObject subclasses #15

Open
alloy opened this issue Jan 5, 2011 · 2 comments

Comments

@alloy
Copy link

alloy commented Jan 5, 2011

This probably means that these problematic classes override handleUnknownMessage:withContext: and do not call super.

These classes include, but may not be limited to:

  • NuCell
  • NSNull
  • NSArray

I'll take a look at this myself, but I've created this ticket as a reminder, as I'll have to do a concise pass over the complete source to see what other classes might need to be fixed as well.

@alloy
Copy link
Author

alloy commented Jan 8, 2011

I've been playing with this and made it work for NuCell & NSArray: https://github.com/alloy/nu

However, the same ‘problem’ applies to NSDictionary, but I haven't been able to think of a way to make it work for that case. The problem is that sending an unknown symbol message which is also not a key in the dictionary currently returns nil, which is consistent with the valueForKey: behavior. I.e. This would be really confusing if this would suddenly return different values, or even raise an unknown handler exception.

Regarding NSNull, none of my naive attempts have allowed me to catch unknown messages.

@alloy
Copy link
Author

alloy commented Jan 8, 2011

Oops, just saw that when running the complete test suite this assertion in test_match.nu fails:

(assert_equal 'nada (match 0 (nil 'zilch) (x 'nada)))

This is because of the dummy NSObject handleUnknownMessage:withContext: method I defined in test_array.nu and test_list.nu. Will have to think about a better way to test it…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant