On Aug 9, 2005, at 10:52 AM, TSa wrote:
~ Foo ~
Is a type that variables etc. can be declared to have
Is not an object
  => I'm really not sure about this...

Bare Foo is a namespace lookup.

Yes, TSa is right. Everything below this is Type-stuff and I will leave that to him (up until the Meta part that is).

The associated type
is something like 'direct instance of Foo'. It is
checked with the .does method. This type is then
used as type parameter to constrain one of the Fantastic
Four ($&@%):

   my Foo $foo; # $foo now of type 'Undef of Foo'

   foo = Foo.new; # type correct because Foo.new.does(Foo)

~ class(Foo) ~
Used as the invocant of class methods
  => Any other purpose?
Is an object; instance of the 'Class' class

From the type system point of view class(Foo) is a Class type.
But that is what bare Foo means anyway if the innermost entry
in the namespace was generated from the class special form.

=> How do we get properly-typed access to members that class(Foo) has
     that aren't declared in 'Class'?

Sorry, I don't understand that. What do you want to access?
Private class data? Or even lower level implementation details?
Everything else should be accessible through namespace syntax:

  &Foo::action(); # action call through Code ref
  $Foo::attr;     # data slot access
  @Foo::attr[42]  # array slot

  given Foo  # binds block owner $/ to Foo, $_ from outside
    &::action();  # &action() etc. work as well

    # or with my idea of slot accessor expressions
    # bound through $/ := Foo


    # or with method dispatch that does not necessarily
    # end up calling a slot in Foo

    my method action # hide OUTER::action
      say "no Foo method but invocant.does(Foo) is $/.does(Foo)";
      # what would next METHOD call here?
    # Note that 'my multi method action' would temporarily install
    # action in an existing outer multi or create a new local one and
    # and install an outer non-multi in it or some such.
    # I'm not the dispatch Guru ;)

    .action(); # prints "no Foo method but invocant.does(Foo) is true"
    .attr;     # MMD could select Foo::Item::attr accessor
    .attr[42]; # MMD could select &postfix:<[ ]>(Foo::Array::attr, 42)

~ meta(Foo) ~
Members contain info /about/ Foo, rather than /of/ Foo
  => This is to avoid name-clashes with 'name', 'authority' etc.
Is an object; instance of the 'MetaClass' class

If avoiding name clashes is all, a simple Foo::META pseudo
namespace and %META hash would do. Why a MetaClass and instances of it?

Avoiding name clashes is one point, and I tried the Foo::META thing at one point. Actually the current meta-model grew out of that early prototype, but soon it outgrew that. IIRC it lead to a lot of code duplication, which likely was an implementation detail.

I hope that .isa, .does and .meta are normal Method subtypes and *not*
slots on some implementation objects/structures.

I am not sure I understand this. Can you elaborate?


$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to