Zenroom icon indicating copy to clipboard operation
Zenroom copied to clipboard

feat(table): ✨ first implementation of pointer system in zencode

Open matteo-cristino opened this issue 2 years ago • 2 comments

More testing is needed before merging

matteo-cristino avatar Oct 24 '23 14:10 matteo-cristino

It is safer to use a pointer that is not inside the HEAP, but in the stack (ZEN.pointer).

Also we can use the keyword "pointer" for all variable names and make it a convention inside Zencode, so that all internal uses of have() will return the pointer contents, in case a ZEN.pointer is non-nil. This will automatically implement all existing statements for usage with pointers. Of course this is theoretical, we need some caution and more test coverage.

jaromil avatar Nov 21 '23 15:11 jaromil

I have a doubt. In the case pointer is stored in the stack, where we should save the codec? Always in the CODEC table or in stack too? If save in the stack I think we would have some problem with statements that look ups for codec from CODEC table, but on the other hand we will have an element not present in the HEAP which codec is present in the CODEC.

Moreover a look on the then part is needed if pointer is saved in the stack since we can print also the pointer.

matteo-cristino avatar Nov 24 '23 10:11 matteo-cristino