Hi Thierry, 2018-02-12 5:48 GMT-03:00 Thierry Goubier <[email protected]>: > Hi Hernan, > > 2018-02-12 7:48 GMT+01:00 Hernán Morales Durand <[email protected]>: >> Hi Eliot, >> >> One could say that a pragma is a message without a method? >> >> I think pragmas were never been integrated properly into the system >> browser. We can browses pragmas with the PragmaCollection but what I >> mean is a pragma-aware browser. See for example, there are some >> pragmas where is easy to infer the meaning: <magritteDescription>, >> <gtInspectorPresentationOrder:>, and others <eProperty> where is not >> so clear. So even if we take <gtInspectorPresentationOrder:> is not >> easy with the current tools to find of which parameters makes sense. I >> always missed something like the annotation pane plugin or the quality >> assistant plugin in Nautilus, but for pragmas. > > What Eliot is pointing out, is that integration is very easy to do as > long as you implement it the way Eliot describes it: you see a pragma, > you select it, search for implementors, and, voilà, you know what the > pragma is for and how it is used (and you may even get a comment for > the parameters). > > Now, you can try to do that in Pharo, and, of course that doesn't > work: I can select the pragma <gtInspectorPresentationOrder: 40>, > search for implementors, and I get none. If I search for senders, > among the few hundreds of senders I get into my pharo 6 image, and > knowing that this should be inside the GT-Inspector-Core package, I > find: > > #GTInspector class >>#extensionsPragma > > Now, following senders of #extensionsPragma, I find about a dozen > senders (because there are multiple implementors of #extensionsPragma, > probably). One of the senders is probably the key: > > ProtoObject>>#gtInspectorPresentationsIn:inContext: > > And the use of #allNamed:from:to:sortedUsing: should give you a clue > about the argument (because, yes there is no comment about the > argument... or even if the pragma should have one...). >
As you noted, that's a long way to find a pragma information. It should be a lot easier. >> This could be an excellent opportunity for Calypso to see how pragmas >> can be exploited in the way you describe. > > As I said above, if used like Eliot describes, then it could be done > just by searching implementors of the pragma symbol. > > Now, implemented as it is in Pharo, I suspect it will be hard to do > even for Calypso. > I see. I would love a popup after each new pragma is defined to write some description. The system can enforce to write documentation! ;) Best regards, Hernán > Regards, > > Thierry > >> Thanks for the kind explanation. >> >> Cheers, >> >> Hernán >> >> >> 2018-02-12 1:09 GMT-03:00 Eliot Miranda <[email protected]>: >>> Hi Hernan, >>> >>> >>> >>> >>> _,,,^..^,,,_ (phone) >>>> On Feb 11, 2018, at 10:47 AM, Hernán Morales Durand >>>> <[email protected]> wrote: >>>> >>>> I don't know, but how you you find documentation about specific pragmas? >>> >>> The best way is to ensure the pragma has at least one implementation, i.e. >>> there is at least one method in the system that has the same signature as >>> the pragma. This implementation should document the pragma, but even >>> better it should be the method that extracts information from the pragma. >>> >>> An example will help. Imagine a pragma that specifies a method belongs on >>> some menu. The method containing the pragma is intended to be an action of >>> the menu, do that when the menu item is selected, the method containing the >>> pragma will b executed. The pragma defines the menu the method belongs to, >>> where in the method, the string to appear in the menu, the hot key for the >>> menu item, etc. >>> >>> If the pragma is implemented by a menu builder then >>> - yes, certainly the pragma can be documented in the m by builder's >>> implementation, but also >>> - the menu can be built by performing the pragma by the menu builder >>> >>> This was my intent when Steve Dahl and I invented pragmas, that there would >>> always be implementations of the pragma in classes that were designed to >>> extract the information from the pragma and add the method containing the >>> pragma to whatever structure the pragma was intended to facilitate updating >>> (menus, inspectors, exported apis, etc). So the most powerful way of use >>> my pragmas is via a visitor pattern: >>> >>> When a method with a particular pragma is added or removed, the class >>> containing the method triggers some action. This action collects all the >>> relevant pragma methods in the class hierarchy, creates some builder >>> object, and has the builder perform each method containing a relevant >>> pragma. >>> >>> Using pragmas as arbitrary labels is fine, bug doesn't exploit the fact >>> that pragmas are messages, and that hence one can do senders and >>> implementors /and/ perform them. >>> >>> HTH >>> >>>> >>>> Hernán >>>> >>>> >>>> 2018-02-11 14:48 GMT-03:00 Stephane Ducasse <[email protected]>: >>>>> Hi >>>>> >>>>> what is this pragma in metaclass method? >>>>> >>>>> Stef >>>>> >>>> >>> >> >
