Interrogative statements

2006-10-19 Thread Jonathan Lang
Let's say that I want $expression?; to mean the same thing as the statement $_ = $expression; That is, any statement that ends with a '?;' instead of a ';' evaluates in scalar context instead of void context and stores the result as the topic '$_'. (I was going to suggest '?' intead of

set operations for roles

2006-10-19 Thread Jonathan Lang
In "class interface of roles", Dr.Ruud wrote: And I was on the line of: role R does A | B | C { ... } # unordered composition $x does ( A, B, C ) ; # ordered composition $y does A | B | C ; # unordered composition but I would like early and late binding to be

Re: class interface of roles

2006-10-19 Thread Jonathan Lang
Larry Wall wrote: Though actually, now that I think about it, the cascaded notation in S12 is illegal according to S03, since "does" is classified as non-chaining, which implies non-associative. Wait a minute. Isn't "chaining" specifically referring to the idea that "A op B op C" implicitly be

Re: class interface of roles

2006-10-19 Thread Dr.Ruud
"Jonathan Lang" schreef: > role R does A does B does C { ... } # unordered composition > $x does A does B does C; # ordered composition > $y does A | B | C; # unordered composition > > I'd like to see it done something like: > > role R does A does B does C { ... } # unordered com

Re: class interface of roles

2006-10-19 Thread TSa
HaloO, Hmm, no one seems to read the article! There actually is another class GenLocSquare that combines GenSquare and GenPointMixin. With that we get a modified version of my code as follows: role GenEqual { method equal( : GenEqual $ --> Bool ) {...} } role GenPointMixin { has Int $.x;

Re: class interface of roles

2006-10-19 Thread Jonathan Lang
TSa wrote: And while we're at it, could we also introduce the subtype operator <: and perhaps >: as the supertype operator? This would come in handy for expressing type constraints in does clauses. Isn't one of those called ".does()"? -- Jonathan "Dataweaver" Lang

Re: class interface of roles

2006-10-19 Thread Jonathan Lang
Ruud H.G. van Tol wrote: Larry Wall schreef: > I suspect ordered composition is going to be rare enough that we can > simply dehuffmanize it to > > $x does A; > $x does B; > $x does C; Maybe use a list-like notation? What happens when you try to mix ordered and unordered compositi

Re: class interface of roles

2006-10-19 Thread TSa
HaloO TSa wrote: I would like "does A & B & C" mean the intersection type of A, B and C. That is a supertype of all three roles. In addition we might need negation to get what Jonathan Lang envisoned for the Complex type that does Num & !Comparable. IOW, I'm opting for a role combination syntax

Re: class interface of roles

2006-10-19 Thread TSa
HaloO, Larry Wall wrote: You've got it inside out. Unordered is just "does A | B | C" or some such, the | there really being coerced to a set construction, not a junction. In fact, & would work just as well. I only used | because it's more readable. Autocoercion of junctions to sets is, of c

Re: class interface of roles

2006-10-19 Thread Ruud H.G. van Tol
Larry Wall schreef: > I suspect ordered composition is going to be rare enough that we can > simply dehuffmanize it to > > $x does A; > $x does B; > $x does C; Maybe use a list-like notation? $x does (A, B, C,) ; $x does (A ; B ; C) ; $x does [A, B, C,] ; $x does [A ; B ;