sin-ack / zigself

An implementation of the Self programming language in Zig
GNU General Public License v3.0
161 stars 5 forks source link

Make it easier to create new prototypes in the VM #17

Closed sin-ack closed 1 year ago

sin-ack commented 2 years ago

As observed by the implementation of _GetAddrInfoForHost:..., we are going to need primitives which return custom objects in the future. I want this to be implemented easier. Right now, we manually create a slots object, but this obviously will not scale; I'd much rather have an easy way of implementing and registering a new object instead.

Of course, with this comes the problem of how to represent the object types. Right now, we encode the object types manually; this also will not scale. We are going to need a vtable implementation for this, where objects can register themselves.

Obviously, other places which switch on the object type will also no longer work. We will also have to move those to each individual object, and have some of that dynamic dispatch goodness on the VM side too. ;^)