On 17 September 2012 13:24, Henrik Sperre Johansen <[email protected]> wrote: > On 17.09.2012 12:28, Igor Stasenko wrote: >> >> This is not a big deal actually, >> since i will introduce a 'OO-callback' which performs a message send >> to an object using certain selector, >> it will be possible, of course, to pass the signature using other way, >> i.e. as an extra argument: >> >> callback := 3 createCallbackFor: #+ signature: #( int (int arg) ) >> >> as well as: >> >> callback := 3 createCallbackFor: #+ > > My 2c: > Does the behavior differ based on the objects class / dynamic state? > (In other words, are there multiple implementors? Does it use private > instvars to accomplish it?)
private ivars? where? the callback implementation is 'private', since it is full of dark voodoo assembly code ;) , but its public interface won't put any special requirements to the object(s) to form a callback. It is just a message send, after all, so you just stating that when this callback get called a given object should receive that message (with callback arguments converted to smalltalk objects , of course), no more no less. The only thing with this kind of callbacks is their lifetime: it will be disposed once a receiver will turn to be garbage, which is logical, since it cannot longer receive any messages. But it even more convenient, because you don't need to keep the callback object around and manage its lifetime by yourself :) The only additional bounds, which make sense to put is to direct the type names/resolution via receiver's class, as well as different code generation options, which it may need. So, you don't have to globally define custom types (or be limited to use only already existing global types/aliases) Like that, if in scope of your class you have an alias 'foo' -> 'int' , you can use 'foo' as a type name in callback signature for an instance of that class. > If not, then I think 'OO-style' is a less elegant solution than keeping that > functionality/responsibility in a class more intricately linked to what it > is used for. > > The march towards the omniprescent Object which knows all, sees all and does > all is tangible, and, at least in my eyes, undesirable :) > well, it is just a convenience protocol for Object, allowing any object(s) to form callbacks. like currently we having #nbCall: , in same way i will add #nbCallback:... protocol (or something like that). > Cheers, > Henry -- Best regards, Igor Stasenko.
