Ilya Zakharevich on Mon, 09 Sep 2019 01:08:58 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Classes vs arrays


When do we mean to cease abusing the silicon’s patience?  It is plain silly
to use arrays (of arrays) to store heterogeneous data…

I propose a binary-compatible way to introduce objects:
  • In memory, an object looks exactly like a list — but type() is different.
  • The list’s reserve storage is 1 word.
  • This word is an integer keeping an offset into the array of classes.

>From the interpreter, two new methods .iclass and .class is accessible.
They return the index of the class, and the first element of the “content”
of the class (presumably, the name).

⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜⁜

This is an absolute minimum to start the things rolling.  The next thing
would be to recognize different MEANINGS of arrays currently used to pass
info around, and start to convert them to classes.  Then one could start
to think about an interface to create objects/classes from the interpreter…

Ilya