> On Jun 24, 2016, at 7:55 AM, Clément Bera <[email protected]> wrote:
> 
> Hi.
> 
> Pragmas are selectors hence they're browsable. You can implement a method 
> somewhere with the pragma selector name that includes the documentation. In 
> VW they were careful about that and most, if not all, of their pragmas are 
> carefully commented this way.
> 
> For example, if you have the pragma <foo> and you implement the method 
> MyClass class >> #foo with some comments in it and you can double click on 
> the pragma <foo> to select its content (foo) and press Cmd+M (or right click 
> implementors) to get to the method having the documentation.

+1.  I can't stress enough how useful it is to make pragmas real selectors with 
implementations and to try and apply them using perform:withArguments:. That's 
when their real power comes in.

For example, if you have some method that wants to be added to some tool, make 
its pragma a message with all the information you need to add it as arguments 
(things like its position or priority relative to other additions, its name in 
the list of components, an icon to use, a string for fly-by help) and then 
implement a builder class whose methods match these pragmas so that when the 
builder performs the pragma it adds the method to the tool, in a given 
position, with a given icon and fly-by help etc.

In most other systems method annotations are simply that, just passive labels.  
But in Smalltalk these are executable.  You can browse for senders and 
implementors, you can execute them using a visitor pattern.  Much more powerful.


> 
>> On Fri, Jun 24, 2016 at 3:54 PM, Alexandre Bergel <[email protected]> 
>> wrote:
>> Hi!
>> 
>> A pragma may be very obscure. For example, I do: 
>> Pragma allInstances anyOne
>> => <debuggerCompleteToSender>
>> 
>> If I want to know more about this <debuggerCompleteToSender> is actually 
>> quite challenging. 
>> I see many methods having that pragma, but not idea what it is for. 
>> I see that Halt>>signalerContext and Process>>complete: that use that pragma 
>> somehow. But still, I have no idea when I should use that pragma in my 
>> method.
>> 
>> What about having a way to comment pragma? Maybe something like 
>> -=-=-=-=-=-=
>> Object subclass: #Pragma
>>      instanceVariableNames: 'method keyword arguments comment'
>> -=-=-=-=-=-=
>> 
>> And a simple way to annotate pragmas?
>> Just an idea. 
>> 
>> Cheers,
>> Alexandre
>> -- 
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>> 
>> 
>> 
> 

Reply via email to