On 16.09.2012 20:42, Stéphane Ducasse wrote:
On Sep 16, 2012, at 7:17 PM, Igor Stasenko wrote:
So, i'd like to hear your input, which one you like, and which ones you prefer to have
1. requires creating a subclass of NBFFICallback, overriding it's fnSpec method. Takes a block closure as a callback. 2. first you must create a factory object by specifying a callback signature, then you can instantiate new callbacks by passing a block closure to that factory 3. to create a callback you must specify it's signature in one of the compiled methods, and specify an object which will receive a message when callback will be called. for what it is worth I like the 3rd form. Now I'm not sure on: is the right selector.
+1, out of those listed #3 seems the most convenient to use. Being able to do something like: Integer >> #+ <types: #( int (int aNumber) )> Then specify the callback parameter as self callback: 3 with: #+ would be really neat. As an added bonus, it also highlights the problems this approach would have with simply annotating normal methods which utilize multiple return/parameter types :) Cheers, Henry