We already have the Set class, how do we say what it contains?

class Set {
        has $.type;

        submethod BUILD {
                # get something into $.type, using 'of' handler
        }

        method members returns $.type () { ... }
}

my Set of Int $s = Set.new; # is this how you call it?

Or do we say

class Set is Container { # magical?
        method members returns returns ... # some facility by Container?
}

Even if the way to implement this is as thin as C++ templates, that
is, we'll have to define a container of some type, and define the
type as a complex thing, instead of defining a container of complex
things, it's still better than nothing.

This brings me to another issue - can I say what type the elements
of a list has, without putting it into a typed array?

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!

Attachment: pgpwpeEILWVhX.pgp
Description: PGP signature

Reply via email to