TSa wrote:
>  Jon Lang wrote:
> > My thoughts:
> > .HOW returns information concerning the implementation type; .WHAT
> > returns information concerning the value type.

BTW, S12 more or less confirms the above: .WHAT returns a prototype
object that stringifies to its short name, while .HOW allows
introspection of the attributes and methods and composed roles and
inherited classes and...

>  My addition to these thoughts is that the WHAT and HOW are
>  cascaded. Let's say we start at level 0 with the objects,
>  thingies or however we want to name the atoms of our discourse.
>  At the zero level HOW, WHAT etc. are vacuously identical with
>  the object. They fall apart on level 1 from each other and among
>  them selfs but they are all sets of level-0 objects. In general
>  a level n concept contains level 0..^n "objects" and is the name
>  for a something they share.

In English, please?

I _think_ that you're saying that you can use WHAT and HOW
recursively: that is, you can talk about WHAT.WHAT, WHAT.HOW,
HOW.WHAT, HOW.HOW, etc.  If so, note a few caveats:
first, if $x is a Foo, then $x.WHAT will be a Foo.  As such, there is
no difference between $x.WHAT and $x.WHAT.WHAT.  Likewise, forget
about my comments about $x.WHAT.HOW; since $x is of exactly the same
type as $x.WHAT, you can get the same information by saying $x.HOW as
you could about $x.WHAT.HOW.

Second, $x.HOW.WHAT gives you a prototype of the metaclass object.  If
you're ever doing type checking that refers to the "metaclass class",
this might be useful; otherwise, don't bother.

Third, $x.HOW.HOW would let you look at the inner workings of the
"metaclass class".  Going beyond that would be redundant, since you'd
be using a metaclass object to look at the metaclass class.

> > >  role Bar { }
> > >  my Bar $x;   # $x is ???
> > >  say $x;          # ???
> > >  say $x.WHAT; # ???
> > >  # This means we can only assign to $x something that does Bar?
> > >
> >
> > This one's tricky: roles cannot be instantiated, so .WHAT cannot be a
> > Bar.
>  What? I would say it is a level 1 WHAT. The next level concept
>  $x.WHAT.WHAT is role. BTW, there are not very many levels up.

Again, English please?

As I said, roles cannot be instantiated.  $x is not a Bar; it is an
object of an anonymous class that does Bar.  $x.WHAT is a prototype
object of $x, meaning that it, too, is an object of an anonymous class
that does Bar.  The only difference between them is that $x may
eventually have a value assigned to it; $x.WHAT never will.  Well...
that, and $x.WHAT stringifies differently than $x does.

> > >  subset EvenInt of Int where { $_ % 2  == 0 };
> > >  my EvenInt $x;  # $x is ???
> > >  say $x;              # ???
> > >  say $x.WHAT;  # Failure?
> > >  # This means we can only assign to $x something that matches the
> > >  # constraint
> >
> > my guess: .WHAT is an EvenInt that stringifies to "EvenInt".  If you
> > want to know about the structure of EvenInt (e.g., which class is it
> > based on, and which subset restrictions have been applied to it), you
> > would refer to .WHAT.HOW.
>  I would argue that $x.WHAT.WHAT is subset. I think the
>  idea of introspection is to have $x.WHAT.of return Int
>  as a level 1 WHAT and $x.WHAT.where return the constraint
>  closure. That said I would expect $x.HOW to be the identical
>  level 1 HOW object that $x.WHAT.of.HOW returns. When Int.WHAT.WHAT
>  is a role then this is undef of Int.

Ah; _that's_ what you mean by cascading levels.  Ugh.

By my understanding, $x and $x.WHAT are both the same kind of thing:
they're both EvenInt.  Again, the only difference is that $x.WHAT will
always be undefined and will stringify to "EvenInt".

> > >  class Dog { }
> > >  class Cat { }
> > >  my Dog|Cat $x;  # $x is ???
> > >  say $x;               # ???
> > >  say $x.WHAT;  # Failure?
> > >  # This means we can only assign to $x something that isa Dog or isa Cat
> >
> > my guess: .WHAT is a Junction that stringifies to "Dog|Cat".  To
> > access the details as to which classes are in the junction and how
> > they are joined, refer to appropriate methods (I believe that Junction
> > includes a method that returns a Set of its members) or maybe to
> > .WHAT.HOW.
>  On level 1 the WHATs of Dog and Cat are distinct. Dog|Cat is a level 2
>  WHAT. The level 2 $x.WHAT.HOW is a union. $x.WHAT.WHAT is class.


Jonathan "Dataweaver" Lang

Reply via email to