Multiple Returns, was Re: Common Lisp style macros in Smalltalk?

agree at carltonfields.com agree at carltonfields.com
Wed Jan 12 00:25:59 UTC 2000


We used to have such a construct in the curly bracket array constructor.  You would return values along the lines of:

	^ { expression1 . expression2 . expression3 }

And use the value with assignments along the lines of

	{ lvalue1 . lvalue2 . lvalue3 } := object foo: argExpression.

Dan's recent changes in 2.6 removed the multiple assignment facility.  He note that it wasn't used in the image, asked quite clearly if anyone cared, and no one spoke up.  As I recall, we got a speed result in return.

The "strict" Smalltalkologist might observe (and it has been observed many times in these letters), that the proper methodological solution is that every such aggregating should have its own aggregating class.  Thus:

	^ Foo with: expresion1 with: expression2 with: expression3.

And then

	lvalue := object makeFoo: argExpression

using constructors to do the work for you.  For truly anonymous scenarios, you always have the Array mainstay, using integer accessors.  (Although the true believers tended to deny that there is ever an appropriate use for Array in this context).

> -----Original Message-----
> From: MIME :dnsmith at watson.ibm.com > Sent: Tuesday, January 11, 2000 7:02 PM
> To: squeak at cs.uiuc.edu
> Cc: squeak at cs.uiuc.edu
> Subject: Multiple Returns, was Re: Common Lisp style macros in
> Smalltalk?
> > > At 20:28 -0800 1/10/2000, Stephen Travis Pope wrote:
> >"Martin B. Pomije" wrote:
> >>
> >>  Has anybody on this list ever contemplated incorporating > CL style macros
> >>  into Smalltalk?  Or am I just stuck in Lispish thinking?
> >
> >I think the latter ("stuck in Lispish thinking"). I, too, came to
> >Smalltalk from LISP, and initially missed several features > of LISP, but
> >the only one I still pine after is multiple value returns.
> > I miss them, too, since I spent a while programming in > PostScript; the symmetry of sending and returning is so nice > it made me like a language that is difficult to love, and > I've missed multiple returns ever since.
> > I came up with some syntax for multiple return values in > Squeak. I don't offhand see any syntax conflicts and I don't > have a clue how to make it work efficiently at runtime, but > it may be something to throw rocks at. I'm concerned about > how often such a feature would really be used; is it worth > making syntax changes?
> > Multiple assignment:   (a b c) := self get3things.
> > Returning values:      ^ x . y squared . z asInteger
> > See attachment for details.
> > Dav
> _______________________________
> David N. Smith
> IBM T J Watson Research Center
> Hawthorne, NY
> _______________________________
> Any opinions or recommendations
> herein are those of the author
> and not of his employer
> > > 

> -----Original Message-----
> From: MIME :dnsmith at watson.ibm.com > Sent: Tuesday, January 11, 2000 7:02 PM
> To: squeak at cs.uiuc.edu
> Cc: squeak at cs.uiuc.edu
> Subject: Multiple Returns, was Re: Common Lisp style macros in
> Smalltalk?
> > > At 20:28 -0800 1/10/2000, Stephen Travis Pope wrote:
> >"Martin B. Pomije" wrote:
> >>
> >>  Has anybody on this list ever contemplated incorporating > CL style macros
> >>  into Smalltalk?  Or am I just stuck in Lispish thinking?
> >
> >I think the latter ("stuck in Lispish thinking"). I, too, came to
> >Smalltalk from LISP, and initially missed several features > of LISP, but
> >the only one I still pine after is multiple value returns.
> > I miss them, too, since I spent a while programming in > PostScript; the symmetry of sending and returning is so nice > it made me like a language that is difficult to love, and > I've missed multiple returns ever since.
> > I came up with some syntax for multiple return values in > Squeak. I don't offhand see any syntax conflicts and I don't > have a clue how to make it work efficiently at runtime, but > it may be something to throw rocks at. I'm concerned about > how often such a feature would really be used; is it worth > making syntax changes?
> > Multiple assignment:   (a b c) := self get3things.
> > Returning values:      ^ x . y squared . z asInteger
> > See attachment for details.
> > Dav
> _______________________________
> David N. Smith
> IBM T J Watson Research Center
> Hawthorne, NY
> _______________________________
> Any opinions or recommendations
> herein are those of the author
> and not of his employer
> > > 





More information about the Squeak-dev mailing list