A random thing I've been wondering; for the first version of the interpreter can we simply not do any reference counting and just clean things up after execution is done?
yeah I'm already assuming that will happen, bc reference counting won't exist yet at that point, and it's only needed for performance, not correctness :grinning_face_with_smiling_eyes:
Hmm.... I don't think this is correct. We definitely need reference counting in the interpreter, but it can be completely dealt at runtime...no pass required.
But definitely required
Cause we have to match the contract with the host and we have to free memory or risk ooms.
It can all just be done adhoc at runtime when calling various functions/builtins or cloning a variable. So it won't be at all optimized....will just be part of the primitive operations and handling of scope
@Brendan Hansknecht we're not far from putting a super minimal interpreter together. We could almost do compile time eval adding a list of integers or something if we wanted to explore the above..
yeah sorry, this was just thinking in terms of internal interpreter for compile-time evaluation of constants
You still would want refcounting for in place mutation and calls to zig builtins
right, the point is that it's not a blocker to getting up and running
obviously we want refcounting, it's just a question of what to do in which order :smile:
Ah. Sure
I just don't want us to design assuming we don't need it
We 100% require it
Also, I think it should be pretty easy to do on the fly as opposed to dealing with all the optimizations
Mostly is just scope tracking and tracking which builtins require a refcount increment.
Last updated: Jul 06 2025 at 12:14 UTC