Login  Register

Re: Use of -> in Pharo Code

Posted by Pharo Smalltalk Users mailing list on Dec 01, 2016; 12:09am
URL: https://forum.world.st/Use-of-in-Pharo-Code-tp4925229p4925409.html

Hi Bruce,

in hsort again ;-)
This was your code:
Teapot on GET: '/welcome' -> 'Hello World!'; start.

Imagine it this way with brackets:

Teapot on GET: ('/welcome' -> 'Hello World!'); start.

This is the same as writing:

Teapot on GET: ( Associtation key: '/welcome' value: 'Hello World!') ; start.

Shorter:

 (x -> y) = (Association key: x value: y)

 The -> is the short version of the Association constructor.

I hope this makes things a little clearer.
Sebastian