[Cuis-dev] What is the meaning of "::" in code examples ?

Alexandre Rousseau yalexr at gmail.com
Fri Mar 10 06:27:59 PST 2023


Yep I understand that.

Since beRow returns the recipient (myLayout beRow = myLayout), the second
example is functional but not recommended (hidden intent).


On Fri, Mar 10, 2023 at 9:10 AM Jon Hylands <jhylands at gmail.com> wrote:

>
>
> On Fri, 10 Mar 2023 at 01:52, Alexandre Rousseau <yalexr at gmail.com> wrote:
>
>>
>> So,
>>
>>> lay1 beRow :: borderWidth: 1 :: borderColor: (Color black) .
>>
>>
>> can also be expressed as
>>
>>> lay1 beRow; borderWidth: 1; borderColor: (Color black).
>>
>> since all messages are intended for the original receiver (lay1).
>>
>
> No, that is not the same at all.
>
> Your first example is equivalent to this:
>
> ((lay1 beRow) borderWidth: 1) borderColor: Color black
>
> The second example would be:
>
> lay1
>     beRow;
>     borderWidth: 1;
>     borderColor: Color black
>
> in the first example #borderWidth: is sent to the result of the #beRow
> method, whereas in the second it is sent to lay1. If #beRow is a method
> that has side effects and returns self then they are functionally
> equivalent, but if it returns a new object then they are not the same at
> all.
>
> - Jon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230310/acff3ca7/attachment.htm>


More information about the Cuis-dev mailing list