Re: supertyping
by TSa other posts by this author
Dec 14 2006 4:06AM messages near this date
Re: supertyping
|
Re: supertyping
HaloO,
Larry Wall wrote:
> role Num is also does Complex {
> method im {...}
> }
Is that the actual syntax? I mean is it the keyword pair
'is also' or does 'also' by itself have a meaning? With
a more natural 'role Num also does Complex'.
> but roles are really supposed to be fairly immutable in the Perl 6
> scheme of things, so such a declaration would probably have to require
> that the Num role never have been composed into anything else yet.
Doesn't a role also do the package role? That is we might just
keep the uncomposed roles and their does-hierarchy around for
later method lookup.
> Or we could say that you can't reopen the Num role; you can only
> reopen the Num class and mix in the Complex role. That's where it
> stands at the moment.
BTW, how is it achieved to have a class Num and a role Num?
Can one just write
role Blahh {...}
class Blahh does Blahh {...}
or is there some hidden magic for built-in types? Array, Hash etc.
seem to pull the same stunt---but how?
Regards, TSa.
--
Thread:
Jonathan Lang
Jonathan Lang
Smylers
Larry Wall
TSa
TSa
Smylers
Ruud H.G. van Tol
Ruud H.G. van Tol
TSa
|