[Pharo-project] Noobs perspective on pasting example code

Ben Coman btc at openInWorld.com
Thu Jan 26 08:15:32 CET 2012

Just a passing thought.... 

It is common convention for example methods to be presented in text 
using '>>' preceded by the class.  This is obviously needed to define 
the class/method relationship outside the image, but the whole example 
cannot be pasted directly into System Browser as the '>>' is not part of 
the Smalltalk syntax for defining methods.  

For those new to Pharo going through tutorials, copy/pasting the whole 
of the presented code eg [1] returns only the error  "Nothing more 
expected" which is a bit cryptic to noobs who expect to follow the 
example verbatim.  Once past understanding this, it continues (for me) 
to be a minor annoyance to have to select only the text following the '>>'.

I wonder whether it would be beneficial for the compiler to handle  
'>>'  at the start of a method definition.  The System Browser would 
then jump to the created method.  As well as beneficial to those 
experiencing Pharo for the first time, this might be useful as a general 
shortcut such that when browsing one class you can define a method for 
another class without first having to browse to that class.

cheers, Ben

BExp>>testBlock: aBlock
| t |
t := nil.
aBlock value

More information about the Pharo-project mailing list