[squeak-dev] What does the underscore do?

Julian Fitzell jfitzell at gmail.com
Sun Jun 7 05:20:24 UTC 2009


It used to be the assignment character of choice in Squeak; it was
displayed as a left-pointing arrow instead of an underscore.

It's not portable between smalltalk though.

Julian

On Sat, Jun 6, 2009 at 9:17 PM, Gary Dunn<osp at aloha.com> wrote:
> As I was poking around in the system browser I came across code that
> used an underscore as if it were an assignment statement. By that I mean
> a _ where I would expect to see a :=. What does it do?
>
> Several examples in the directory: method in FileList2.
>
> directory: dir
>        "Set the path of the volume to be displayed."
>
>        self okToChange ifFalse: [^ self].
>
>        self modelSleep.
>        directory _ dir.
>        self modelWakeUp.
>
>        sortMode == nil ifTrue: [sortMode _ #date].
>        volList _ Array with: '[]'.
>        directory ifNotNil: [
>                volList _ volList, directory pathParts.  "Nesting suggestion from RvL"
>        ].
>        volList _ volList withIndexCollect: [:each :i | ( String new: i-1
> withAll: $ ), each].
>        self changed: #relabel.
>        self changed: #volumeList.
>        self pattern: pattern.
>        directoryChangeBlock ifNotNil: [directoryChangeBlock value: directory].
>
>
> --
> Gary Dunn, Honolulu
> osp at aloha.com
> http://openslate.net/
> http://e9erust.blogspot.com/
> Sent from Slate001
>
>
>



More information about the Squeak-dev mailing list