[Pharo-project] Noobs perspective on pasting example code

Ben Coman btc at openInWorld.com
Thu Jan 26 09:57:09 CET 2012


Thanks Milan. Something new I've learnt.  However I don't think this is 
a conflict.
While your example works from Workspace, go where you define a method 
and try to get the following accepted.

String >> #asDate
    ^1

The above is not valid, so no conflict in this context. 


Milan Mimica wrote:
> #>> already does something.  Try printing "String >> #asDate". It fetches a
> compiled method.
>
> On 26 January 2012 08:15, Ben Coman <btc at openinworld.com> wrote:
>
>   
>> 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
>>
>> [1]
>> BExp>>testBlock: aBlock
>> | t |
>> t := nil.
>> aBlock value
>>
>>
>>
>>
>>     
>
>
>   




More information about the Pharo-project mailing list