From: Jim Weirich Date: 2006-03-16T22:35:55+09:00 Subject: Re: Variant types Stefan Haflidason wrote: > My languages lecturer is a fan of a feature called 'variant' in a model > language he defined. The variant declaration is used to specify that a > variable may be of one or another type If I understand correctly, it sounds very much like a static lanugage concept, with little applicability to Ruby. The problem with implementing it is Ruby is not to open up variables to more than one type (that happens automatically), but to artificially restrict the variable to the explicitly listed types. > When he stated that no languages we are taught have this functionality, Perhaps the key phrase is "we are taught", because as described, variants sound much like a union in C. If I recall correctly, even Pascal has variant records that did much the same thing. Of course, I may be misunderstanding yor description. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.