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?
Hi Bruce, good to see you around, again! The arrow is an Association in short... Sebastian Am 29.11.2016 um 18:48 schrieb Bruce Prior:
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?
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
Would be nice to have a video with that. Phil On Wed, Nov 30, 2016 at 6:25 AM, Martin McClure <martin@hand2mouse.com> 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
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
Hi bruce welcome and I hope that you have fun. What I noticed is that we get used really fast to supercool tools. Last year I had to work on a VW 2.5 version and I thought someone had cut my hands. I ws so slow with senders and implementors and rudimentary inspectors :) Stef
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?
-- Using Opera's mail client: http://www.opera.com/mail/
Hi Stef, Thanks for the welcome back. I always have fun with Smalltalk in the Winter but each year Summer seems to get in the way. I appreciate your reminiscences, but I still don't understand what the right aero (->) does. Bruce On 2016-11-30 12:21 PM, stepharo wrote:
Hi bruce
welcome and I hope that you have fun.
What I noticed is that we get used really fast to supercool tools. Last year I had to work on a VW 2.5 version and I thought someone had cut my hands. I ws so slow with senders and implementors and rudimentary inspectors :)
Stef
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?
-- Using Opera's mail client: http://www.opera.com/mail/
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
participants (7)
-
Ben Coman -
Bruce Prior -
David T. Lewis -
Martin McClure -
phil@highoctane.be -
Sebastian Heidbrink -
stepharo