On IRC, ruoso wrote:
wayland, one important thing I didn't mention in the mail is that I
understand that if some attribute is going to be undefined for some cases in
a Role, then it doesn't belong in that role, but in a more specialized
one...
the good thing about roles is that they don't require an hierarchy
(which is what makes the Java API so terrible)
One problem (as I mentioned elsewhere just now) is that I'm trying to
specify an API with optional parts. Maybe I should stop using roles for this
:).
I'd argue, also that Undefined isn't really undefined, it's really a
value. For example, say you malloc some memory in C, there could be anything
in it; it really *is* undefined. Whereas the Perl 6 "Undefined" value is
guaranteed to always return "Undefined".
I guess it's because I was expecting people using a composition of
Tree to go:
if(! defined($footree.root)) { warn "Unrooted tree"; }
...instead of
if(! $footree.has('$root')) { warn "Unrooted tree"; }
# Does this even work???
Or maybe even:
try {
$footree.root;
CATCH {
when /Error: has no attribute named 'root'/ {
warn "Unrooted tree";
}
}
}
...you can see why I prefer the first one :).
Anyway, HTH,
---------------------------------------------------------------------
| Name: Tim Nelson | Because the Creator is, |
| E-mail: wayl...@wayland.id.au | I am |
---------------------------------------------------------------------
----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V-
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----