On 4/26/2010 3:47 PM, Hannes Hirzel wrote:
> And: to me the code for the menu definitions looks ugly. A kind of > assembler like, lisp-s expression thing with a lot of implied > assumptions. I think you're missing the point of why one would use an annotation. They're there for discovery by other code. You are basically announcing "hey if anyone cares, here's an action that you might want to place in a menu". MenuSpec doesn't achieve that. Yes, you got a menu spec, but now what? You also need a registry, let's say TheWorldMenu. Then you add another registry for TheMainDockingBar. Then we refactor this and introduce new classes, say the TheMainMenu and TheContextMenu. Now you've got to deal with four different situations. This all goes away by using annotations. If there's code that knows how to discover these specs, it will do so. If not, it just leaves the code alone. Most importantly a third party trying to extend the main menu doesn't need to update their code because the implementation in the base system changes. > The MenuSpec is a straighforward thing. And I think it is more > appealing for the younger generation. I fail to see what age has to do with this discussion. However, if you look at the "current" crowd of programming languages they pretty much all have annotations, from C# to Python, which are used for very similar purposes. > The practical problem we are currently facing with Squeak 4.1 is that > it cannot display pictures in the the file browser and that adding > entries to the menu is not possible in a clean way. Correct, but I see this as a an example of a discussion on how we achieve a more decoupled system. For the purpose at hand, where we'd like 3rd parties to use and extend the base system while allowing the base system itself to evolve, I find the annotation-based discovery superior to hardcoded references to classes and registries that may not exist in this form in the future. Cheers, - Andreas |
In reply to this post by Hannes Hirzel
On 27.04.2010, at 00:47, Hannes Hirzel wrote:
> > And: to me the code for the menu definitions looks ugly. A kind of > assembler like, lisp-s expression thing with a lot of implied > assumptions. You mean this? MenuEntrySpec newFrom: (Dictionary newFromPairs: #( contents 'Well... hello?' help 'Displays the Hello World' location ('Help') target MenuMorph selector inform: arguments ('Hello World!') position first)) Yes, looks a lot like s-expressions. No, I don't like it either. Glad we agree on that. But weren't you arguing *for* this? I'm getting confused. Balázs proposed this: <createDockingBarMenuWithPriority: 50> <fillDockingBarMenu: #extras priority: 20> - Bert - |
In reply to this post by Andreas.Raab
On 4/26/10, Andreas Raab <[hidden email]> wrote:
> On 4/26/2010 3:47 PM, Hannes Hirzel wrote: >> And: to me the code for the menu definitions looks ugly. A kind of >> assembler like, lisp-s expression thing with a lot of implied >> assumptions. > > I think you're missing the point of why one would use an annotation. > They're there for discovery by other code. You are basically announcing > "hey if anyone cares, here's an action that you might want to place in a > menu". > > MenuSpec doesn't achieve that. Yes, you got a menu spec, but now what? > You also need a registry, let's say TheWorldMenu. Then you add another > registry for TheMainDockingBar. Then we refactor this and introduce new > classes, say the TheMainMenu and TheContextMenu. Now you've got to deal > with four different situations. This all goes away by using annotations. > If there's code that knows how to discover these specs, it will do so. > If not, it just leaves the code alone. > > Most importantly a third party trying to extend the main menu doesn't > need to update their code because the implementation in the base system > changes. > >> The MenuSpec is a straighforward thing. And I think it is more >> appealing for the younger generation. > > I fail to see what age has to do with this discussion. However, if you > look at the "current" crowd of programming languages they pretty much > all have annotations, from C# to Python, which are used for very similar > purposes. > >> The practical problem we are currently facing with Squeak 4.1 is that >> it cannot display pictures in the the file browser and that adding >> entries to the menu is not possible in a clean way. > > Correct, but I see this as a an example of a discussion on how we > achieve a more decoupled system. For the purpose at hand, where we'd > like 3rd parties to use and extend the base system while allowing the > base system itself to evolve, I find the annotation-based discovery > superior to hardcoded references to classes and registries that may not > exist in this form in the future. > > Cheers, > - Andreas > > convincing for me. --Hannes |
In reply to this post by Bert Freudenberg
On 4/26/10, Bert Freudenberg <[hidden email]> wrote:
> On 27.04.2010, at 00:47, Hannes Hirzel wrote: >> >> And: to me the code for the menu definitions looks ugly. A kind of >> assembler like, lisp-s expression thing with a lot of implied >> assumptions. > > You mean this? > > MenuEntrySpec newFrom: (Dictionary newFromPairs: #( > contents 'Well... hello?' > help 'Displays the Hello World' > location ('Help') > target MenuMorph selector inform: arguments ('Hello World!') > position first)) Actually I would not call this s-expression. It is regular Smalltalk code because it uses keyword messages. > Yes, looks a lot like s-expressions. No, I don't like it either. Glad we > agree on that. But weren't you arguing *for* this? I'm getting confused. > Balázs proposed this: > <createDockingBarMenuWithPriority: 50> > > <fillDockingBarMenu: #extras priority: 20> > > - Bert - Basically I need to get used to the idea that we do menus in an orthogonal plane. Are other programming languages doing this for menus as well? Java which I have been using in the last years surely not. However as a whole - not too bad. I'm fine if you go ahead and commit the pragma based solution to the trunk. --Hannes |
On 4/26/10, Hannes Hirzel <[hidden email]> wrote:
> On 4/26/10, Bert Freudenberg <[hidden email]> wrote: >> On 27.04.2010, at 00:47, Hannes Hirzel wrote: >>> >>> And: to me the code for the menu definitions looks ugly. A kind of >>> assembler like, lisp-s expression thing with a lot of implied >>> assumptions. >> >> You mean this? >> >> MenuEntrySpec newFrom: (Dictionary newFromPairs: #( >> contents 'Well... hello?' >> help 'Displays the Hello World' >> location ('Help') >> target MenuMorph selector inform: arguments ('Hello World!') >> position first)) > Yes, I agree with you Bert. It looks somewhat like s-expressions. But it need not. I could construct the dictionary with 'regular' Smalltalk code. Having a dictionary to move parameters around is quite common. However as I said in my previous message - the pragma based solution is fine for me. --Hannes |
In reply to this post by Andreas.Raab
On 27 April 2010 02:11, Andreas Raab <[hidden email]> wrote:
> I find the annotation-based discovery superior to hardcoded > references to classes and registries that may not exist in this form in the > future. > +1 > Cheers, > - Andreas > > -- Best regards, Igor Stasenko AKA sig. |
Explain please. I must be too sleepy to follow this.
- Steve On Apr 26, 2010, at 6:45 PM, Igor Stasenko <[hidden email]> wrote: > On 27 April 2010 02:11, Andreas Raab <[hidden email]> wrote: >> I find the annotation-based discovery superior to hardcoded >> references to classes and registries that may not exist in this >> form in the >> future. >> > +1 >> Cheers, >> - Andreas >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > |
On 4/26/2010 4:55 PM, Steve Wessels wrote:
> Explain please. I must be too sleepy to follow this. Explain what? Did you read my post? What is unclear about it? Cheers, - Andreas > On Apr 26, 2010, at 6:45 PM, Igor Stasenko <[hidden email]> wrote: > >> On 27 April 2010 02:11, Andreas Raab <[hidden email]> wrote: >>> I find the annotation-based discovery superior to hardcoded >>> references to classes and registries that may not exist in this form >>> in the >>> future. >>> >> +1 >>> Cheers, >>> - Andreas >>> >>> >> >> >> >> -- >> Best regards, >> Igor Stasenko AKA sig. >> > > |
In reply to this post by Igor Stasenko
On 27 April 2010 02:45, Igor Stasenko <[hidden email]> wrote:
> On 27 April 2010 02:11, Andreas Raab <[hidden email]> wrote: >> I find the annotation-based discovery superior to hardcoded >> references to classes and registries that may not exist in this form in the >> future. >> > +1 However, i'd like to add, that indirect forms of declarations (like pragma annotations) is not always sufficient, because it makes impossible a direct communication between services, and thus having a limited potential. The code example like following: MenuEntrySpec newFrom: (Dictionary newFromPairs: #( contents 'Well... hello?' help 'Displays the Hello World' location ('Help') target MenuMorph selector inform: arguments ('Hello World!') position first)) introducing a rigid factors, because of use of globals (here - MenuEntrySpec and MenuMorph). In contrast, if we turn it into a set of declarations like this <createDockingBarMenuWithPriority: 50> <fillDockingBarMenu: #extras priority: 20> is just an annotations, which not quite informal, since there is no usual sender-implementor chain and no direct communication, which can be tracked, debugged. You should implement a separate discovery mechanism, which searching for these annotations and controls the menu creation & its properties. Also, there is no any guarantee, that these annotations will be taken into account by system, while obviously a package author expects from a system to react on them and act accordingly. So, we could have our cake and eating it too: - do not use globals (like MenuEntrySpec). Really, a format (or class) which is used for holding a menu spec is totally irrelevant to an external package. So, why external package should care about these details, why not like following: Object>>globalMenuRegistry ^ World menuRegistry "whatever" MyExternalPackageClass class>>initialize self addMenuEntry. MyExternalPackageClass class>>addMenuEntry self globalMenuRegistry addMenuEntry: #( contents 'Well... hello?' help 'Displays the Hello World' location ('Help') target selector #inform: arguments ('Hello World!') position first) forClass: self So, as simple as that: - an external package expects from system to support a certain protocol, which can be used to access various system services (in our case , this is a #globalMenuRegistry) - an external package expects from menuRegistry to support a certain protocol, which can be used to add menu entries and control other various properties. So, that's how we can at the same time keep system decoupled, and be able to have a direct communications between service & consumer. Just stop using globals and build the basic system infrastructure based on message sends and protocols. >> Cheers, >> - Andreas >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > -- Best regards, Igor Stasenko AKA sig. |
On 4/26/2010 5:13 PM, Igor Stasenko wrote:
> So, we could have our cake and eating it too: > - do not use globals (like MenuEntrySpec). Really, a format (or class) > which is used for holding a menu spec is totally irrelevant to an > external package. So, why external package should care about these > details, why not like following: > > Object>>globalMenuRegistry > ^ World menuRegistry "whatever" > > MyExternalPackageClass class>>initialize > self addMenuEntry. > > MyExternalPackageClass class>>addMenuEntry > > self globalMenuRegistry addMenuEntry: #( > contents 'Well... hello?' > help 'Displays the Hello World' > location ('Help') > target selector #inform: arguments ('Hello World!') > position first) > forClass: self > > So, as simple as that: > - an external package expects from system to support a certain > protocol, which can be used to access various system services > (in our case , this is a #globalMenuRegistry) > - an external package expects from menuRegistry to support a certain > protocol, which can be used to add menu entries and control other > various properties. > > So, that's how we can at the same time keep system decoupled, and be > able to have a direct communications between service& consumer. > Just stop using globals and build the basic system infrastructure > based on message sends and protocols. That ends up with code like here: MCWorkingCopy class>>initialize (TheWorldMenu respondsTo: #registerOpenCommand:) ifTrue: [TheWorldMenu registerOpenCommand: {'Monticello Browser'. {self. #open}}] which is precisely why I don't like it. It is also subject to the evolution system - how long is it going to take until we figure that the method shouldn't be called Object>>globalMenuRegistry etc. Finally, I should also add that you *can* browse senders and implementors of annotations. Try for example browsing senders/implementors of #preference:category:description:type: to see what I mean. Cheers, - Andreas |
On 27 April 2010 05:08, Andreas Raab <[hidden email]> wrote:
> On 4/26/2010 5:13 PM, Igor Stasenko wrote: >> >> So, we could have our cake and eating it too: >> - do not use globals (like MenuEntrySpec). Really, a format (or class) >> which is used for holding a menu spec is totally irrelevant to an >> external package. So, why external package should care about these >> details, why not like following: >> >> Object>>globalMenuRegistry >> ^ World menuRegistry "whatever" >> >> MyExternalPackageClass class>>initialize >> self addMenuEntry. >> >> MyExternalPackageClass class>>addMenuEntry >> >> self globalMenuRegistry addMenuEntry: #( >> contents 'Well... hello?' >> help 'Displays the Hello World' >> location ('Help') >> target selector #inform: arguments ('Hello World!') >> position first) >> forClass: self >> >> So, as simple as that: >> - an external package expects from system to support a certain >> protocol, which can be used to access various system services >> (in our case , this is a #globalMenuRegistry) >> - an external package expects from menuRegistry to support a certain >> protocol, which can be used to add menu entries and control other >> various properties. >> >> So, that's how we can at the same time keep system decoupled, and be >> able to have a direct communications between service& consumer. >> Just stop using globals and build the basic system infrastructure >> based on message sends and protocols. > > That ends up with code like here: > > MCWorkingCopy class>>initialize > (TheWorldMenu respondsTo: #registerOpenCommand:) > ifTrue: [TheWorldMenu registerOpenCommand: {'Monticello Browser'. > {self. #open}}] > It should look like: MCWorkingCopy class>>initialize self worldMenu registerOpenCommand: {'Monticello Browser'. {self. #open}} > which is precisely why I don't like it. It is also subject to the evolution > system - how long is it going to take until we figure that the method > shouldn't be called Object>>globalMenuRegistry etc. > But same applies to annotations. How long it will take to figure out that instead of <createDockingBarMenuWithPriority: 50> you need: <createDockingBarMenuWithPriority: 50 andColor: #red> ? Take it or leave it, but all such #createDockingBarMenuWithPriority: is also defines a protocol, which something somewhere must recognize and react on it in order to make things work. Isnt? And so, i think designing a good, future-proof protocols is answer to your question. I'm not saying that we should hastily add tons of Object>>serviceXXxXxxxRegistry etc.. lets wisely consider what we need and slowly introduce it by deprecating the old uses. > Finally, I should also add that you *can* browse senders and implementors of > annotations. Try for example browsing senders/implementors of > #preference:category:description:type: to see what I mean. > Yes, you can. But still its a little different from putting a halt and see how it works and where it goes. > Cheers, > - Andreas > > -- Best regards, Igor Stasenko AKA sig. |
In addition. What prevents us from defining a protocol to rule out
other (unstable) protocols? :) (self systemProtocol: 'Squeak4.1' ) ifNotNilDo: [:protocol | protocol globalMenuRegistry addStuff.... ] On 27 April 2010 06:04, Igor Stasenko <[hidden email]> wrote: > On 27 April 2010 05:08, Andreas Raab <[hidden email]> wrote: >> On 4/26/2010 5:13 PM, Igor Stasenko wrote: >>> >>> So, we could have our cake and eating it too: >>> - do not use globals (like MenuEntrySpec). Really, a format (or class) >>> which is used for holding a menu spec is totally irrelevant to an >>> external package. So, why external package should care about these >>> details, why not like following: >>> >>> Object>>globalMenuRegistry >>> ^ World menuRegistry "whatever" >>> >>> MyExternalPackageClass class>>initialize >>> self addMenuEntry. >>> >>> MyExternalPackageClass class>>addMenuEntry >>> >>> self globalMenuRegistry addMenuEntry: #( >>> contents 'Well... hello?' >>> help 'Displays the Hello World' >>> location ('Help') >>> target selector #inform: arguments ('Hello World!') >>> position first) >>> forClass: self >>> >>> So, as simple as that: >>> - an external package expects from system to support a certain >>> protocol, which can be used to access various system services >>> (in our case , this is a #globalMenuRegistry) >>> - an external package expects from menuRegistry to support a certain >>> protocol, which can be used to add menu entries and control other >>> various properties. >>> >>> So, that's how we can at the same time keep system decoupled, and be >>> able to have a direct communications between service& consumer. >>> Just stop using globals and build the basic system infrastructure >>> based on message sends and protocols. >> >> That ends up with code like here: >> >> MCWorkingCopy class>>initialize >> (TheWorldMenu respondsTo: #registerOpenCommand:) >> ifTrue: [TheWorldMenu registerOpenCommand: {'Monticello Browser'. >> {self. #open}}] >> > nope it doesn't. > It should look like: > > MCWorkingCopy class>>initialize > self worldMenu registerOpenCommand: {'Monticello Browser'. {self. #open}} > >> which is precisely why I don't like it. It is also subject to the evolution >> system - how long is it going to take until we figure that the method >> shouldn't be called Object>>globalMenuRegistry etc. >> > But same applies to annotations. > > How long it will take to figure out that instead of > > <createDockingBarMenuWithPriority: 50> > > you need: > > <createDockingBarMenuWithPriority: 50 andColor: #red> > ? > > Take it or leave it, but all such #createDockingBarMenuWithPriority: > is also defines a protocol, > which something somewhere must recognize and react on it in order to > make things work. Isnt? > > And so, i think designing a good, future-proof protocols is answer to > your question. > > I'm not saying that we should hastily add tons of > Object>>serviceXXxXxxxRegistry etc.. > > lets wisely consider what we need and slowly introduce it by > deprecating the old uses. > > >> Finally, I should also add that you *can* browse senders and implementors of >> annotations. Try for example browsing senders/implementors of >> #preference:category:description:type: to see what I mean. >> > Yes, you can. > But still its a little different from putting a halt and see how it > works and where it goes. > > >> Cheers, >> - Andreas >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > -- Best regards, Igor Stasenko AKA sig. |
In reply to this post by Igor Stasenko
On 4/26/2010 8:04 PM, Igor Stasenko wrote:
> On 27 April 2010 05:08, Andreas Raab<[hidden email]> wrote: >> That ends up with code like here: >> >> MCWorkingCopy class>>initialize >> (TheWorldMenu respondsTo: #registerOpenCommand:) >> ifTrue: [TheWorldMenu registerOpenCommand: {'Monticello Browser'. >> {self. #open}}] >> > nope it doesn't. > It should look like: > > MCWorkingCopy class>>initialize > self worldMenu registerOpenCommand: {'Monticello Browser'. {self. #open}} That assumes that #worldMenu is on class Object. An assurance that you can't make over time. So whoever is trying to extend the system is forced to adapt the code for any and all supported versions since you don't have a way of safely ignoring things. >> which is precisely why I don't like it. It is also subject to the evolution >> system - how long is it going to take until we figure that the method >> shouldn't be called Object>>globalMenuRegistry etc. >> > But same applies to annotations. > > How long it will take to figure out that instead of > > <createDockingBarMenuWithPriority: 50> > > you need: > > <createDockingBarMenuWithPriority: 50 andColor: #red> > ? I don't know. But it doesn't break. Even in its most naive use. The service isn't recognized by the system you install it in, but it doesn't blow up in your face. Given that we're trying to move things forward and build them in a modular way, I think that's a good property. BTW, only when you put *all* of it together, avoiding the need to refer to external global class names, avoiding the need to explicitly test for method compliance, automatic discovery by many tools (i.e., both the world menu and the docking bar can discover the same menu annotation but you'd have to provide separate selectors or globals to adjust for that), being both forward and backwards compatible; so when you put *all* of this together, there is no doubt in my mind that annotations are superior to the proposed alternatives. They have weaknesses, admitted, but these weaknesses are negligible for an application like we're discussing here. > And so, i think designing a good, future-proof protocols is answer to > your question. That's definitely an important aspect and holds for annotations as well. > I'm not saying that we should hastily add tons of > Object>>serviceXXxXxxxRegistry etc.. > > lets wisely consider what we need and slowly introduce it by > deprecating the old uses. Are you actually proposing to introduce Object>>worldMenu? If so, I'm completely opposed to the proposal. Polluting the global namespace like that serves no purpose whatsoever. OTOH, if you're saying that we should evaluate the use of annotations carefully in the context of each potential use, I'm with you. I don't like an abuse of annotations either. However, for situations like we're talking about, where third party code tries to add services to the base system, I think it's a good idea. That includes its use for preferences, the world menu / docking bar, and for example file services. >> Finally, I should also add that you *can* browse senders and implementors of >> annotations. Try for example browsing senders/implementors of >> #preference:category:description:type: to see what I mean. >> > Yes, you can. > But still its a little different from putting a halt and see how it > works and where it goes. True. It's harder to debug annotations if they don't do what you think they should. A good reason for keeping 'em simple. Cheers, - Andreas |
On 27 April 2010 06:33, Andreas Raab <[hidden email]> wrote:
> On 4/26/2010 8:04 PM, Igor Stasenko wrote: >> >> On 27 April 2010 05:08, Andreas Raab<[hidden email]> wrote: >>> >>> That ends up with code like here: >>> >>> MCWorkingCopy class>>initialize >>> (TheWorldMenu respondsTo: #registerOpenCommand:) >>> ifTrue: [TheWorldMenu registerOpenCommand: {'Monticello Browser'. >>> {self. #open}}] >>> >> nope it doesn't. >> It should look like: >> >> MCWorkingCopy class>>initialize >> self worldMenu registerOpenCommand: {'Monticello Browser'. {self. >> #open}} > > That assumes that #worldMenu is on class Object. An assurance that you can't > make over time. So whoever is trying to extend the system is forced to adapt > the code for any and all supported versions since you don't have a way of > safely ignoring things. > >>> which is precisely why I don't like it. It is also subject to the >>> evolution >>> system - how long is it going to take until we figure that the method >>> shouldn't be called Object>>globalMenuRegistry etc. >>> >> But same applies to annotations. >> >> How long it will take to figure out that instead of >> >> <createDockingBarMenuWithPriority: 50> >> >> you need: >> >> <createDockingBarMenuWithPriority: 50 andColor: #red> >> ? > > I don't know. But it doesn't break. Even in its most naive use. The service > isn't recognized by the system you install it in, but it doesn't blow up in > your face. Given that we're trying to move things forward and build them in > a modular way, I think that's a good property. > wrong and needs to be fixed. Its really depends on intent. Nothing stopping you from implementing a DNU handler which ignoring uknown messages and warns user istead of opening debugger. > BTW, only when you put *all* of it together, avoiding the need to refer to > external global class names, avoiding the need to explicitly test for method > compliance, automatic discovery by many tools (i.e., both the world menu and > the docking bar can discover the same menu annotation but you'd have to > provide separate selectors or globals to adjust for that), being both > forward and backwards compatible; so when you put *all* of this together, > there is no doubt in my mind that annotations are superior to the proposed > alternatives. They have weaknesses, admitted, but these weaknesses are > negligible for an application like we're discussing here. > having own limits. >> And so, i think designing a good, future-proof protocols is answer to >> your question. > > That's definitely an important aspect and holds for annotations as well. > Indeed. >> I'm not saying that we should hastily add tons of >> Object>>serviceXXxXxxxRegistry etc.. >> >> lets wisely consider what we need and slowly introduce it by >> deprecating the old uses. > > Are you actually proposing to introduce Object>>worldMenu? If so, I'm > completely opposed to the proposal. Polluting the global namespace like that > serves no purpose whatsoever. > I'm already proposed before to use Smalltalk as a hub for all such things.. For example: Smalltalk userInterface browser open. Smalltalk userInterface mainMenu registerMenuItem: .... Smalltalk vm version. and so on. > OTOH, if you're saying that we should evaluate the use of annotations > carefully in the context of each potential use, I'm with you. I don't like > an abuse of annotations either. However, for situations like we're talking > about, where third party code tries to add services to the base system, I > think it's a good idea. That includes its use for preferences, the world > menu / docking bar, and for example file services. > >>> Finally, I should also add that you *can* browse senders and implementors >>> of >>> annotations. Try for example browsing senders/implementors of >>> #preference:category:description:type: to see what I mean. >>> >> Yes, you can. >> But still its a little different from putting a halt and see how it >> works and where it goes. > > True. It's harder to debug annotations if they don't do what you think they > should. A good reason for keeping 'em simple. > > Cheers, > - Andreas > > -- Best regards, Igor Stasenko AKA sig. |
In reply to this post by Andreas.Raab
On Mon, Apr 26, 2010 at 2:23 PM, Andreas Raab <[hidden email]> wrote:
Let me be specific. I'm not confused (about this at least). I know that the old "primitive pragma" actually specified code. However, it was /called/ a primitive pragma, and the "pragma" terminology descends from that incorrect usage.
|
In reply to this post by Andreas.Raab
On Mon, Apr 26, 2010 at 12:05 PM, Andreas Raab <[hidden email]> wrote: On 4/26/2010 11:48 AM, Eliot Miranda wrote: I know, but within ParcPlace a <primitive: 123> mark was /called/ a primitive pragma, and so "pragma" was the term we used (without sufficient thought) when we did the menu and exception "pragma" work in vw3.0.
|
In reply to this post by Hannes Hirzel
> Yes, I do not question the usefulness of pragmas for what they have
> been used so far. Primitives and version control related things. I > oppose to use them in addition for menu definitions. Hi Hannes, I agree with you. A new non-Smalltalk construct appears and we see that it starts to get used for lots of things where before we would have just used plain Smalltalk.. Can we stay with Smalltalk everywhere except where it's impossible or impractical to? > adding > entries to the menu is not possible in a clean way. I don't know about displaying the pictures, I just use the 'open' button. But, I do use the "services" function to add my own custom application functions to the file-list. Did you know about that or are you saying that it needs improvement..? > > --Hannes > > On 4/26/10, Bert Freudenberg <[hidden email]> wrote: >> On 27.04.2010, at 00:21, Hannes Hirzel wrote: >>> >>>> Terminology is important and the terminology we currently >>>> have is *extremely* confusing. >>> >>> And that is why I am reluctant having these pragmas 'crawl' into menu >>> definitions. >> >> Now that's just silly, sorry. Nobody is questioning the utility of these >> guys, whatever we call them. >> >> - Bert - >> >> >> >> > > |
Nevermind.. I'm late to this party..
On Wed, Apr 28, 2010 at 2:18 PM, Chris Muller <[hidden email]> wrote: >> Yes, I do not question the usefulness of pragmas for what they have >> been used so far. Primitives and version control related things. I >> oppose to use them in addition for menu definitions. > > Hi Hannes, I agree with you. A new non-Smalltalk construct appears > and we see that it starts to get used for lots of things where before > we would have just used plain Smalltalk.. > > Can we stay with Smalltalk everywhere except where it's impossible or > impractical to? > >> adding >> entries to the menu is not possible in a clean way. > > I don't know about displaying the pictures, I just use the 'open' > button. But, I do use the "services" function to add my own custom > application functions to the file-list. Did you know about that or > are you saying that it needs improvement..? > >> >> --Hannes >> >> On 4/26/10, Bert Freudenberg <[hidden email]> wrote: >>> On 27.04.2010, at 00:21, Hannes Hirzel wrote: >>>> >>>>> Terminology is important and the terminology we currently >>>>> have is *extremely* confusing. >>>> >>>> And that is why I am reluctant having these pragmas 'crawl' into menu >>>> definitions. >>> >>> Now that's just silly, sorry. Nobody is questioning the utility of these >>> guys, whatever we call them. >>> >>> - Bert - >>> >>> >>> >>> >> >> > |
Chris,
I was just thinking along the same lines. However the discussions led to a nice writeup by Andreas Raab 'Annotations for Service Discovery' http://squeakingalong.wordpress.com/2010/04/27/annotations-for-service-discovery/ I think the arguments laid out there are convincing. The 'Menu Registry' thread has to be read in parallel. That is the next area of application for pragmas (synomym 'method property' or 'method annotation') are the menu definitions. It's like a second floor. Or a thing orthogonal to the regular source code in the methods. But pragmas are still Smalltalk messages. They are just sent used by different objects. The compiler / menu bar builder / documentation builder or whatever. The question in the Menu registry thread is: 'How are method annotations for menus going to look like'. --Hannes P.S. I am currently checking out as what Pharo has done in this area. On 4/28/10, Chris Muller <[hidden email]> wrote: > Nevermind.. I'm late to this party.. > > On Wed, Apr 28, 2010 at 2:18 PM, Chris Muller <[hidden email]> wrote: >>> Yes, I do not question the usefulness of pragmas for what they have >>> been used so far. Primitives and version control related things. I >>> oppose to use them in addition for menu definitions. >> >> Hi Hannes, I agree with you. A new non-Smalltalk construct appears >> and we see that it starts to get used for lots of things where before >> we would have just used plain Smalltalk.. >> >> Can we stay with Smalltalk everywhere except where it's impossible or >> impractical to? >> >>> adding >>> entries to the menu is not possible in a clean way. >> >> I don't know about displaying the pictures, I just use the 'open' >> button. But, I do use the "services" function to add my own custom >> application functions to the file-list. Did you know about that or >> are you saying that it needs improvement..? >> >>> >>> --Hannes >>> >>> On 4/26/10, Bert Freudenberg <[hidden email]> wrote: >>>> On 27.04.2010, at 00:21, Hannes Hirzel wrote: >>>>> >>>>>> Terminology is important and the terminology we currently >>>>>> have is *extremely* confusing. >>>>> >>>>> And that is why I am reluctant having these pragmas 'crawl' into menu >>>>> definitions. >>>> >>>> Now that's just silly, sorry. Nobody is questioning the utility of these >>>> guys, whatever we call them. >>>> >>>> - Bert - >>>> >>>> >>>> >>>> >>> >>> >> > > |
In reply to this post by Eliot Miranda-2
Weighing in on a 2 day dead topic is probably passe` around here... :)
I can weigh in with some practical/historical experience from VisualWorks land, where they originated. 1) We use them more and more. But judiciously. What they are really good for is defining programatic categorization of methods, so that one can discover programatically subsets of behavior that a given Behavior implements. Examples include the obvious <settings..> and <menu..> sort of things. We use them in the RefactoringBrowser to make certain aspect easily pluggable, such as adding your own tool pane, navigator pane, or status pane. The inspector uses them to support arbitrary inspector fields on any object. We even use them in <test>s, because I've found that you tend to make better test selector names, when your brain isn't trying to negotiate coming up with a good selector name that describes what your test does AND begins with the 4 characters 'test'. I used them in production code more and more when I was at Key writing UIs and control systems for optical food sorting equipment. Why not just use a method categories (protocols)? Because you can't quite put enough information there to make them useful, and they're stuck with just one category. You want simplicity and judicious application, deferring to good ol' messages as much as possible, but simple categories just don't provide enough. 2) I push, at ever juncture I can, the term <tagged methods> and <method tags>. The <tag> term grew on me for a set of reasons. Technically, they result in "AnnotatedMethods", and one can call each item an "Annotation". But that's a big long word, and using small short words always keeps things simpler. I also liked the harmony with the fact that we live in a world dominated by <tag><markup><languages> and they're called tags there. Since we were using roughly the same syntax, why not go with it? It's also easier to draw an icon that shows up next to methods for <tagged methods> than it is for <annotated methods> (see attached pic). 3) You can get carried away with <method tags>. It's tempting to grow little micro-DSLs with these things. They don't scale well for that. They're far from turing complete, and you're limited to literal objects. Best example of this is the nightmare that the method tags for menus were turning into VW. I wrote about this here: http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Menu_Items_Are_Objects_Too&entry=3354355944 4) History repeats itself, I think I wrote a post along these lines, about 3+ years ago. I've slept since then tho, so I'm not sure. -- Travis Griggs Objologist "The best way to know you have a mind is to change it" -Judge Pierre Leval Picture 2.png (17K) Download Attachment |
Free forum by Nabble | Edit this page |