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

Damien Pollet damien.pollet at gmail.com
Sun Apr 20 16:16:30 BST 2008


On Thu, Apr 17, 2008 at 7:24 PM, Andres Valloud
<andres.valloud at gmail.com> wrote:
> Can you provide a specific bit of code?

I use it in Citezen (on squeaksource), class side of BibPhraseLibrary.

This is a place where I needed to specify pattern-matching, so I use a
syntax like:
foo rules: {
    [condition 1] -> [result 1].
    [condition 2] -> [result 2]
}

This code describes a value, not behavior, so I wanted a syntax that
was declarative and didn't require to build and assemble objects too
explicitely.


> 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
>
>



-- 
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



More information about the ANSI-Smalltalk mailing list