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
>> 
> 

Reply via email to