Re: [stack] Some thoughts on Object Cat

"Christopher Diggins" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Fri, Apr 18, 2008 at 4:42 PM, Daniel Ehrenberg <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.