Login  Register

Re: Use of -> in Pharo Code

Posted by David T. Lewis on Nov 30, 2016; 12:41pm
URL: https://forum.world.st/Use-of-in-Pharo-Code-tp4925229p4925264.html

On Tue, Nov 29, 2016 at 09:25:18PM -0800, Martin McClure wrote:

> On 11/29/2016 06:48 PM, Bruce Prior wrote:
> >I have been away from smalltalk coding for a while. On returning to
> >the fold, I often see the use of a right arrow in code. Is this
> >something new?
> >
> >Today in a Teapot app example, I saw,
> >
> >Teapot on GET: '/welcome' -> 'Hello World!'; start.
> >
> >What is the arrow for?
>
> As Sebastian said, #-> is a message that creates an Association, with
> the receiver as the key and the argument as the value of the
> Association. This has actually been around a very long time, though
> perhaps it's getting more widely used these days. It doesn't appear to
> be in the Blue Book, but I think it was probably actually in the
> Smalltalk-80 image 1 release.
>
> I'm not *quite* curious enough to verify that by rooting around in my
> basement for the machine that actually runs that version and seeing if
> it will still power up after all these years. :-)
>
> Regards,
>
> -Martin
>

It is present in the Squeak 1.13 image of 1996, which I think is fairly
close to Blue Book.

You can run that original image from this web page:

 http://try.squeak.org

Dave