Re: Generic classes.

2005-08-16 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 11:07:51AM -0700, Larry Wall wrote: > Sure, except that you're not really inheriting from a role here. > You're really inheriting from an anonymous class of the same name. :-) Hmm, "Anonymous class with the name 'Array of Any'" sounds like an oxymoron. Also consider:

Re: Generic classes.

2005-08-15 Thread Larry Wall
On Tue, Aug 16, 2005 at 01:49:02AM +0800, Autrijus Tang wrote: : Aye. But if a Role can be inherited _from_, then this should : work too, right? : : role Point { : has $.x; has $.y; : method move_right { $.x++ } : }; : role OurPoint is Point { : method move_right { .

Re: Generic classes.

2005-08-15 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 10:43:45AM -0700, Larry Wall wrote: > : So the last line means a role can be used just like a class, and > : _inherit_ its behaviour as well? > : > : role Point { has $.x; has $.y; method move_right { $.x++ } }; > : role MyPoint is Point { > : method move_right

Re: Generic classes.

2005-08-15 Thread Larry Wall
On Tue, Aug 16, 2005 at 01:33:56AM +0800, Autrijus Tang wrote: : On Mon, Aug 15, 2005 at 08:19:38AM -0700, Larry Wall wrote: : > I think the distinction is still useful to document that there are : > still unbound types. What we need to emphasize is that a role can be : > used as a class, at which

Re: Generic classes.

2005-08-15 Thread Autrijus Tang
On Mon, Aug 15, 2005 at 08:19:38AM -0700, Larry Wall wrote: > I think the distinction is still useful to document that there are > still unbound types. What we need to emphasize is that a role can be > used as a class, at which point any unbound types are bound to Any, > or whatever we're calling

Re: Generic classes.

2005-08-15 Thread Larry Wall
On Sun, Aug 14, 2005 at 08:28:33PM +0800, Autrijus Tang wrote: : S06 made many explicit uses of generics as classes, which I find : difficult to reconcile with the "only roles takes type parameter" : ruling. For example: : : my Hash of Array of Recipe %book; : my Hash[returns=>Array[retur