Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing object and slot annotations #5

Open
sin-ack opened this issue Mar 1, 2022 · 0 comments
Open

Implementing object and slot annotations #5

sin-ack opened this issue Mar 1, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@sin-ack
Copy link
Owner

sin-ack commented Mar 1, 2022

Problem

As ZigSelf's capabilities grow, some issues with using it arises. For starters, there is no good way to declare where an object belongs, i.e. the slot it should be reachable at. In addition, there is no way to give objects their own representation that could be printed because this would not work with traits objects which don't have the slots that a printing method would expect.

Solution

Have ObjectAnnotation and SlotAnnotation object types which would have pre-defined slots for storing each property that we would expect. Each object map and slot would hold a reference to their own annotation object. This would make integrating with the existing VM easy, but could potentially be heavier (because objects and slots with no annotations still have to hold a reference to an annotation object). This could be alleviated by making annotation objects immutable, and starting out objects and slots with a known empty slot.

These objects would need syntax or primitives to instantiate them in order to be filed out.

Potential Problems

  1. If we ever decide to add other annotations after the snapshot format is stabilized, we would be unable to read older snapshots (although this is unlikely in practice).
  2. While the annotations are defined in the VM, they are facilitated by the programming environment; is it right to introduce values specific to the programming environment into the base VM?
@sin-ack sin-ack added the enhancement New feature or request label Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant