Thank you for the explanations. In particular reading the comment in the Pragma class was helpful. I feel now much more comfortable with the idea of using them. However I still think they are more related to VM primitives and configuration issues. The menu is a GUI related thing and having a MenuSpec feels somewhat more natural....
--Hannes
P.S. There are currently 854 methods which have a pragma in them.
On 4/26/10, Levente Uzonyi leves@elte.hu wrote:
On Mon, 26 Apr 2010, Hannes Hirzel wrote:
Hello Philipp
I took a fresh 4.1 image, updated it to 10012, and loaded Morphic-phite.429.mcz.
As the comments were fine I was quickly able to write an example (code below).
Then I had to choose 'Rebuild menus'
It worked fine. The question is now (see another thread by Bert) if we should go or your solution (MenuSpec based) or the one by Steve Wessels (Pragma based).
It's Balázs Kósi who implemented the registration method with pragmas (http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-April/149534.htm... ).
I do not feel too comfortable with pragmas yet whereas the MenuSpec is something I easily understand. And in addition I have the gut feeling that pragmas are meant for some more basic things (a kind of compiler directive, see http://en.wikipedia.org/wiki/Directive_%28programming%29)
Pragmas in Squeak are not directives (though they can be used as directives) but a way to add metadata to a method. So the wikipedia page is irrelevant. If take a look at the class comment of Pragma, you'll feel more comfortable with them. (I think that we should convert all preferences to pragma-style. It could be a goal for 4.2.)
Like Bert I would like to see some discussion **on this issue, but not too along as I would like to start using this feature asap.
We should review both methods, consider the benefits and drawbacks and then make a decision.
Levente
Hannes
** The thread started by Bert at http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-April/149563.htm...
Model subclass: #MyReallyNiceApplication instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'MyMenuTests'!
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
MyReallyNiceApplication class instanceVariableNames: ''!
!MyReallyNiceApplication class methodsFor: 'as yet unclassified' stamp: 'hjh 4/26/2010 08:52'! menuEntrySpecification "Test to add another entyr in the Help menu"
^MenuEntrySpec newForDockingBarFrom: (Dictionary newFromPairs: #( #contents 'Hello?' #location #('Help' 'a subMenu' 'another subMenu') #target MenuMorph #selector #inform: #arguments #('Hello World!!') )) ! !