On Tue, 12 Jun 2001, Mathieu Bouchard wrote: > > > 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. ChoiceTypes? > 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). Isn't the caching an implementation detail? A singleton pattern uses "new", even when subsequent calls will return the cached object created with the first call. > Btw I forgot to mention that in RX11 I use "Either" instead of "Union". > Do you prefer the name "Either" ? I think I know what you're aiming for. Union is a list of possible parse paths, and only one of them will be taken? Perhaps "Grammer", "Rules" or "Context"? Seeing the example you posted: > QRegexp = tuple([:pattern,QString|IString],[:flags,String]) makes it clearer how you intend this to be used. My suggestions would make the above into: QRegexp = Tuple[:pattern, Union[QString, IString], [:flags, Union[String]] Which doesn't look as good. Perhaps the correct answer is "yes", and all of your proposals are good ones... Have the Thing[], Thing.new, Thing.of and Thing() forms... then if I care about the caching, I can use "of", or if I'm me, I can use "new", or if I'm Fred, I can use []. Or if I'm Dave, I can use Thing[].new([*a ||= of]) or some other weird, yet orthogonal, feature of the language. :) -- spwhite / chariot.net.au