[Cuis-dev] >> notation

Hernán Wilkinson hernan.wilkinson at 10pines.com
Thu Aug 1 09:22:15 PDT 2024


well, the right way to write would be:

Number>>#squared
...

Because the receiver is Number, the #squeared is an instance method. If it
was a class method it should be written:
Number class>>#squared
....

Remember that it is not syntax, it is a message send.

Hernan.



On Thu, Aug 1, 2024 at 12:58 PM Mark Volkmann <r.mark.volkmann at gmail.com>
wrote:

> Thanks! I didn't know that >> was an instance method in the Behavior class
> that takes a Symbol.
>
> But I was referring to the use of >> in documentation. For example, page
> 34 of the Cuis Book contains the following:
>
> Number>>squared
>
>     "Answer the receiver multiplied by itself."
>
>     ^ self * self
>
>
> Here I believe the intent is to make it clear that squared is a method in
> the Number class and not to represent valid syntax.
>
>
> So my question is whether when used in documentation this way it always
> describes an instance method.
>
> And second, is there another notation used in documentation to describe
> class methods that is different from this.
>
> On Thu, Aug 1, 2024 at 10:07 AM Hernán Wilkinson <
> hernan.wilkinson at 10pines.com> wrote:
>
>> Foo>>#bar is a collaboration.
>> Foo receives de message >> with the parameter #bar
>> If you look at the implementation of #>> in Behavior you will see that it
>> does ^self compiledMethodAt: ...
>>
>> Using Foo>>#bar as documentation as if it was a "notation" is one of the
>> beautys of Smalltalk, it shows who simple and consistent is and its
>> "meta-circularity" we could say...
>>
>> On Thu, Aug 1, 2024 at 11:54 AM Mark Volkmann via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>
>>> I understand that
>>>
>>> Foo>>bar
>>>
>>> is not valid Smalltalk syntax and is just notation seen in documentation
>>> that means bar is a method in the class Foo.
>>> Can I assume that bar is an instance method and not a class method?
>>> Is there a different notation for class methods?
>>>
>>> --
>>> R. Mark Volkmann
>>> Object Computing, Inc.
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>>
>> --
>>
>> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
>> *Phone: +54-011*-4893-2057
>> *Twitter: @HernanWilkinson*
>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240801/bf6dabea/attachment-0001.htm>


More information about the Cuis-dev mailing list