« Return to Thread: Some thoughts on Object Cat

Re: Some thoughts on Object Cat

by Christopher Diggins :: Rate this Message:

Reply to Author | View in Thread

On Fri, Apr 18, 2008 at 4:42 PM, Daniel Ehrenberg <microdan@...> wrote:

>
>
> In this system, is there any polymorphism over field names? It looks
> like there isn't really. Also, how do you plan to support prototype
> OO? In Io, for example, you might do
>
> something := Object clone
> something slot := value
>
> But in Cat, or at least the subset I know about, you can only define
> procedures, not variables in this way.
>
> How do you plan to get around
> this?

I don't know IO so I have to assume your code translates to the
following ECMAScript

  something = new Object();
  something.slot = value;

I was thinking this would translate to

  object value slot+

Considering something more general

  something = new Object();
  something.slot = 42;
  ...
  something.slot = "hello";

Would become:

  object 42 slot+ ... "hello" slot+

What is a little weird is that "slot+" can allow us to override
"slots" at run-time which is what we in a prototype-based language.

The "slot!" syntax would be used when we are sure the slot already
exists. (e.g. converting to Cat from Java) and want a type error, when
the slot can't be found statically.

What I am lacking is to distinguish between a getter that always works
(returning "undefined" when not found) and another that causes a type
error.

- Christopher

 « Return to Thread: Some thoughts on Object Cat

LightInTheBox - Buy quality products at wholesale price!