On Tue, 12 Jun 2001, Stephen White wrote:
> On Tue, 12 Jun 2001, Mathieu Bouchard wrote:
> I don't really understand what the choices, unions, lists and tuples are
> doing,

They are not doing anything, they are just there. They could be used for
type-checking.

> Could I suggest:
>   Tuple[foo,tfoo,bar,tbar,baz,tbaz] (presuming they're always paired)

No, because the equivalent in RubyX11 sometimes has a third field
descriptor for optional stuff; and I'd prefer find a solution that will
unite RubyX11 and RubyAST.

> Here's some of my reasoning, so you know where I'm going wrong...
> > 	choice foo,bar,baz         (current RubyAST,RubyX11)
> 'choice' would need to be a function call in the same namespace as the
> program being written. I hate ncurses for that reason.

ok. it's there in RubyX11 because i don't feel like changing it to
Choice.of or something.

> > 	ChoiceType.new foo,bar,baz
> Reasonable, but I already know it's a Type.

It's not just a type. It's a class of types. ChoiceType.new foo,bar,baz
creates a new type containing the three objects foo,bar,baz; you can test
for membership.

> > 	ChoiceType.of foo,bar,baz
> The 'of' is a nice idea to make it read well, but it's different and
> I would have to remember it.

I chose "of" because it's like the "of" in Ada, used for type
parametrization. However contrary to unions and lists, the type
parameters are not types themselves.

Maybe it's best to use "new" when there is a guarantee of returning a new
object at every call (like Tuple);

and to use "of" when all returned objects are cached permanently (List
and Union).

Btw I forgot to mention that in RX11 I use "Either" instead of "Union". Do
you prefer the name "Either" ?

> Hopefully this could be within another namespace like:
>   RubyAST::Choice[foo,bar,baz]

sure. it's already like that.

matju