TooTallNate/NodObjC — pull request #43 by trevorlinton (2014-08-13 20:00:12+00:00)
Title: Resolution to Issue 42 - Seg fault on wrong type

The issue is fairly simple, if a wrong type definition is passed in when creating a method (instance or class) and its used as a delegate in objective-c we'll have a crash. This checks to see if the passed in ID is truly an ID. It also defines a secondary type system when registering delegates that makes it a bit easier.

@TooTallNate Let me know what you think of this secondary type system, its backwards compatible but might be a bit clearer for users. For example;

Instead of
MyClass.addInstanceMethod('selector:', 'v@:@', .... )

the user could do:
MyClass.addInstanceMethod('selector:', [$.void,[MyClass,$.selector,$.NSRect]], ... )

Having users specify the cryptic structure type in the first is very difficult, the type system is a bit difficult to deal with and hopefully we can formalize it eventually, this should at least check for a REASONABLE type (not the right type), and secondarily make it easier for users to specify the right type without needing to know the entire obj-c type encoding system.