Yuval Kogman wrote:
> We already have the Set class, how do we say what it contains?
> class Set {
>has $.type;
>method members returns $.type () { ... }
> }
> my Set of Int $s = Set.new; # is this how you call it?
You are describing "Higher Order" types, also called Generic Algebraic Dat
On Mon, May 30, 2005 at 18:51:19 +0200, "TSa (Thomas Sandla)" wrote:
> class Set does Array {...}
I don't like this... A set is just a simple example... What if I
want something sillier?
My question is really:
"How do I make sub foo returns $computable"
And how do I make this friendly
Yuval Kogman wrote:
my Set of Int $s = Set.new; # is this how you call it?
This whole thing depends on how hard-wired the first level
container implementation is. There is either a loose or
very strict mapping from sigils to container types:
$ --> Scalar/Item
@ --> Array
% --> Hash
& -
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 cal