Larry Wall wrote: > On Mon, Nov 07, 2005 at 01:05:16PM +0100, TSa wrote: > : With the introduction of kind capture variables ^T we could complety > : drop the subtype special form. As you pointed out the adding of > : constraints happens with the where clause anyway. Thus we return to > : the usage of the compile time name assignment form > : > : ::Blahh ::= ::Fasel where {...} > : > : where the :: in all cases means working on the MIR (Meta Information > : Repository) which is the world of names (In Russian, Mir (Мир) means > : "peace," and connotes "community." --- cited from Wikipedia). > > Except that a type declarator can remove the need for all those extra :: > markers. (Actually, the ::Fasel can be presumably written Fasel if > Fasel is already declared, so the only strangeness is on the left. > We could hack identifier-left-of ::= like we did identifier-left-of =>, > or we could turn ::= into more of a general alias macro idea. But I think > people generally like declarators out to the left for readability.)
So, why not call the thing what it is---a set *type* declarator! set SmallInt of Int where { abs < 10 }; set SomeNums of Num = (3.14, 4, 89, 23.42); set Bit of Int = (0,1); Enumerations are then just sets of pairs set NumWords of Pair = { zero => 0, one => 1, two => 2, three => 3 }; # or with ( ... ) instead? enum NumWords = <zero one two three>; # short form of the above Without the 'of' it doesn't look so good set Num SomeNums = (3.14, 4, 89, 23.43); but OTOH, it looks nicely like my Num @SomeNums = (3.14, 4, 89, 23.43); my Int %NumWords = { zero => 0, one => 1, two => 2, three => 3 }; YMMV, though ;) Does that work? Perhaps even while maintaining compatibility with the set *value* creator sub that exists in Pugs, IIRC? my $x = set( 1, 2, 3 ); # $x contains a set reference at best -- $TSa.greeting := "HaloO"; # mind the echo!