A nice run-through of the syntax possibilities. I hope it catches on.

BobG

Stephen White wrote on 12 Jun 2001
>On Tue, 12 Jun 2001, Mathieu Bouchard wrote:
>
>> 	Choice[foo,bar,baz]
>> 	UnionType[foo,bar,baz]
>> 	ListType[foo]
>> 	TupleType.of [foo,tfoo],[bar,tbar],[baz,tbaz]
>
>I don't really understand what the choices, unions, lists and tuples are
>doing, but the above appears to be the syntax that seems to be the most
>common. Could I suggest:
>
>  Choice[foo,bar,baz]
>  Union[foo,bar,baz]
>  List[foo]
>  Tuple[foo,tfoo,bar,tbar,baz,tbaz] (presuming they're always paired)
>  Tuple[[foo,tfoo],[bar,tbar],[baz,tbaz]] (if they're not)
>
>if that's feasible?
>
>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.
>
>> 	ChoiceType.new foo,bar,baz
>
>Reasonable, but I already know it's a Type.
>
>> 	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.
>
>> 	ChoiceType[foo,bar,baz]
>
>The same as "Hash[]" so familar through previous usage. Also suits the
>list-like nature of foo,bar,baz. But I already know it's a Type.
>
>> 	Choice.new foo,bar,baz
>
>Better.
>
>> 	Choice.of foo,bar,baz
>
>My brainspace is very limited. I can remember 'new' even though it
>doesn't look as nice. :)
>
>> 	Choice[foo,bar,baz]
>
>This is better. All the benefits of ChoiceType[], without telling me
>that it's a Type (which I already knew).
>
>Hopefully this could be within another namespace like:
>
>  RubyAST::Choice[foo,bar,baz]
>
>so I can have that nice warm glow of knowing that I don't have to memorise
>more words I can't use when thinking of names for my stuff. I already have
>enough trouble with the existing words.
>
>Maybe this is totally dumb, but that's me. :)
>
>--
>  spwhite / chariot.net.au