[squeak-dev] Menu bar (was: The Trunk: Morphic-kb.240.mcz)

Igor Stasenko siguctua at gmail.com
Fri Nov 20 15:07:08 UTC 2009


2009/11/20 Balázs Kósi <rebmekop at gmail.com>:
> Hi,
>> However, I'm wary of storing blocks in the menu items.
>>
>> The canonical style is to store a receiver and a message, which leads to far less complications down the road. That's why in the menu item we have target, selector, and arguments instance variables, instead of a block.
> Doesn't the new closure blocks mitigate those problems? Can you elaborate a bit?
> Blocks are so much more convenient.
>
+1
the only problem with blocks, that they capturing all state (context,
receiver, temps etc), required to run. And you can't replace the
target as you may do it if action defined using message send..

Nonetheless, you still can mitigate these problems in blocks by using
message sends , like:

onClick:  [ self target buttonClicked]

instead of capturing target object directly:

onClick:  [ target buttonClicked]

>> Also, I'd rather move the updating behavior into the submenu itself. It doesn't really make sense to reserve an inst var in every menu item, plus a top-level menu might need updating too, not just a sub menu.
>>
>> In fact, looking at it, I'm not the first with this idea :) There is an UpdatingMenuMorph for exactly that purpose.
> It don't think that this was its exact purpose, but I hijacked it:
> Morphic-kb.242 in The Inbox.
> What do you think?
>
> Balázs
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list