Re: proposal: rename 'subtype' declarator to 'set'
On Fri, 11 Nov 2005, Eric wrote: I think 'subset' might be a nicer colour for this bikeshed. For an [snip] Ehh. By that definition arn't all sets subsets? Anyway I didn't see It depends on the axiomatic model of your choice. Speaking of which it is perhaps not terribly OT to discuss here which one to mimic for Perl6 -provided that it is sensible/advisable/useful to mimic one axiomatic set theory at all-: a class based one (a' la Goedel-Bernays) or a Universe based one? Michele -- The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. - Ninety-Ninety Rule
Re: proposal: rename 'subtype' declarator to 'set'
On Wed, Nov 09, 2005 at 01:45:21PM +0100, TSa wrote: : 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); Interesting idea. I expect a bit of interference from the verb to set, but that's probably not a showstopper, particularly since the next token isn't a variable. : 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 ;) I'd like to lose the = if possible. We don't say sub foo = { ... } : 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 They can perhaps be unified, especially if we lose the = noise. Probably have to require the parens syntactically though, just as though you'd said my $x = my($a,$b,$c); Larry
Re: proposal: rename 'subtype' declarator to 'set'
On 12/11/05, Larry Wall [EMAIL PROTECTED] wrote: On Wed, Nov 09, 2005 at 01:45:21PM +0100, TSa wrote: : 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); Interesting idea. I expect a bit of interference from the verb to set, but that's probably not a showstopper, particularly since the next token isn't a variable. I think 'subset' might be a nicer colour for this bikeshed. For an extra three characters you lose the confusion with to set, and it highlights the fact that you're (usually) declaring a *constrained* subset of the original type. Stuart
Re: proposal: rename 'subtype' declarator to 'set'
I think 'subset' might be a nicer colour for this bikeshed. For an extra three characters you lose the confusion with to set, and it highlights the fact that you're (usually) declaring a *constrained* subset of the original type. Stuart Ehh. By that definition arn't all sets subsets? Anyway I didn't see any confusion with to set at all. subset confused me quite a bit though. Besides it might not be a sub set at all. set types full half quarter jumbo automatic; You could call that a subset of words, but i think this has extra clarity over: subset types full half quarter jumbo automatic; First thing i think when seeing that is...subset of what? where is the larger set defined? Of course I have no knowledge of set theory at all, just a humble programming giving his input.
proposal: rename 'subtype' declarator to 'set'
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!