[ANSI-Smalltalk] re: array creation syntax (was: expressing method signatures)

Michael Klein mklein at alumni.caltech.edu
Thu Apr 17 19:10:47 BST 2008


I think the brace array syntax encourages the use of arrays
as ad-hoc object without classes.

in the old days, associations were used to do this i.e.

desire
	^'this' ->'now'

instead of a class named Desire:

whatDoYouWant
	^'that'

whenDoYouWantIt
	^'real soon'

I suggest you do senders of #braceStream, #braceWith:with: .... etc.  
(in Squeak)
and form your own opinion.

-- Mike


On Apr 17, 2008, at 10:24 AM, Andres Valloud wrote:
> Can you provide a specific bit of code?
>
> Andres.
>
> On Wed, Apr 16, 2008 at 1:26 PM, Damien Pollet  
> <damien.pollet at gmail.com> wrote:
> 2008/3/22 Andres Valloud <andres.valloud at gmail.com>:
> > I think something that is being left unaddressed is whether using  
> literal
> > arrays that allow code expressions (e.g.: the brace syntax in  
> Squeak) is a
> > good practice or not.  In my experience, I have not felt the need  
> for such
> > things, but maybe I have not been exposed to particular  
> circumstances in
> > which they become useful.  Does anybody have some slam dunk  
> examples that
> > can be shared so that we can evaluate this better?
>
> I find them useful for domain-specific languages, i.e. you want to
> pass multiple runtime values to a method while making it look like a
> keyword followed by a list. Cascade is the alternative but then you
> need to keep track of state in the receiver, and an additional message
> if you want a final treatment after all values are passed.
>
> --
> Damien Pollet
> type less, do more [ | ] http://people.untyped.org/damien.pollet
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk




More information about the ANSI-Smalltalk mailing list