> ----- Original Message ----- > From: "Damian Conway" <[EMAIL PROTECTED]> > To: "Perl6" <[EMAIL PROTECTED]> > Sent: Tuesday, March 11, 2003 9:35 PM > Subject: Re: A6: overloading multis on constness of parameters > > > > Joe Gottman wrote: > > > > > Will it be possible in perl6 to overload multis on the const-ness of > a > > > parameter, like C++ does? For instance, > > > > > > multi getX(Foo $self:) returns Int {...} #const version > > > multi getX(Foo $self: is rw) returns Int is rw {...} #non-const > version > > > > That second one would have to be: > > > > multi getX(Foo $self is rw:) returns Int is rw {...} > > > > > > Then we have the issue that Perl 6 objects can't really be "constant", > > since C<is constant> is a compile-time trait of *containers*...really just > > a "don't assign to this container" marker. > > > > However, within those limitations, I guess it's possible. After all, we > have > > to check for lvaluability of C<is rw> parameters anyway. > > How would I take a get a reference to the second one? I assume I could > get a reference to the first by > > $ref = &getX(Foo);
Well, if there's overloading based on traits, siglets must support traits. So, it would have to be: $ref = &getX(Foo is rw:); (The first would be) $ref = &getX(Foo:); Backwhacking those couldn't hurt, either. Luke