HaloO,

Luke Palmer wrote:
On 8/9/05, Larry Wall <[EMAIL PROTECTED]> wrote:

So why not just use "describes"?  Then maybe Object.isa(Foo) delegates
to $obj.meta.describes(Foo).


Hmm. We have a similar problem with the new class-set notation. These two things:

Did I miss something? What is the class-set notation?

    $a.does(Foo);
    Bar.does(Foo);

Mean two different things:

Really?

    $a (e) Foo;    # or whatever we decide for `elem`
    Bar (<=) Foo;

"does" is a nice dwimmy name--it works linguistically for both of
those concepts--but it would be nice to have two names that are
unambiguous for the two cases that "does" delegates to.

I interpret .does as the Perl6 equivalent of the <: operator
used in type theory to denote the subtype relation. The usual
rules for linking a class hierarchy and the type lattice is
to define classes as type instanciators. That is, all *direct*
instances share the "type" that they were created by the same
class instance. This direct-instance-of type is not uncontstraintly
transitive.

  class A      {...}
  class B is A {...}  # B.does(A) needs a check!

  my B $b = B.new;

  $b.does(A);  # unknown

BTW, I hope that the imperative dynamic role enforcing operator

  $b does X;

works in such a way that former constraints that become violated
by this operation lead to expelling the object $b refers to
e.g. from ::T.does(B). I hope no one expects &infix:does to be
a cheap operation? It should involve type contraint computations
that reposition $b in the type lattice.

I'm not sure how the .isa method works exactly. But I think it
simply traverses the inheritance hierachy "upwards" such that
$b.isa(A) returns true in the above example.


Of course, we could use "element" and "subset", but that doesn't work
well for people who don't like to think of types in terms of sets. Infinite sets aren't exactly beginner-friendly.

Same applies to F-bounded polymorphism.


Any ideas?  I've never been very good at coming up with good names.

How about

  $b.by(B);   # $b created by class B
  $b.from(B); # instanciated from B
  $b.of(B);   # like nobility names if that is how it works in english

This check is not transitive. Thus $b.from(A) is false.
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to