Defining methods with double greater than sign (>>) in Smalltalk

gnu-smalltalk, smalltalk

Solution

In fact this is Pseudo code.

In other languages you would use the `.` to tell people that the method is in this class but in smalltalk you write `>>`

What you would do in a Smalltalk like Squeak or Pharo for

Point class>>x: xNumber y: yNumber
    ^self new
        setX: xNumber
        y: yNumber

- Open the System Browser

- klick on class, a button that will show you the class side of the class.

paste the method in the text area with the source code:

x: xNumber y: yNumber
    ^self new
        setX: xNumber
        y: yNumber

Strg-s to save the code

For

Point>>setX: xNumber y: yNumber
    x := xNumber.
    y := yNumber.
    ^self

You would do the same but not use the class side

Problem

In the book Smalltalk Best Practice Patterns from Kent Beck, the double greater sign (`>>`) is used to define methods like this: ``` Point class>>x: xNumber y: yNumber ^self new setX: xNumber y: yNumber Point>>setX: xNumber y: yNumber x := xNumber. y := yNumber. ^self ``` However, I cannot get it run in GNU Smalltalk. Is it valid syntax in some implementation of Smalltalk? Or is it just kind of pseudo code?

Original source