You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've grown to like the idea of an implicit context (i.e. Odin, Jai).
It's brilliant for making your allocator explicit (we can move away from the "there is one global heap" system) while not forcing you to thread stuff throughout all of your code.
I'm also very interested if we can generalize the concept of an implicit context.
I've noticed that a very common pattern is my Rust code is creating a "FooContext" struct and threading it through all of the code that deals with Foo. Why can't we use the same implicit context mechanism (not necessarily the same context variable, but some way to declare an implicit context?) to thread something like that through?
Ultimately, I think maybe it would look something like:
There is a global implicit 'context' that contains the allocator. It is truly implicit. It has a fixed list of fields.
There is a way to define a semi-implict context struct for a set of functions. It is semi-implicit, because I think we still want to show that the functions are connected and depend on a context. Maybe named parameters help here and we just establish a ctx: ctx pattern and forego this, idk.
some more discussion over at zig issue 1286 (not linking it because i don't want github to cross-link my stuff there)
The text was updated successfully, but these errors were encountered:
I've grown to like the idea of an implicit context (i.e. Odin, Jai).
It's brilliant for making your allocator explicit (we can move away from the "there is one global heap" system) while not forcing you to thread stuff throughout all of your code.
I'm also very interested if we can generalize the concept of an implicit context.
I've noticed that a very common pattern is my Rust code is creating a "FooContext" struct and threading it through all of the code that deals with Foo. Why can't we use the same implicit context mechanism (not necessarily the same
context
variable, but some way to declare an implicit context?) to thread something like that through?Ultimately, I think maybe it would look something like:
some more discussion over at zig issue 1286 (not linking it because i don't want github to cross-link my stuff there)
The text was updated successfully, but these errors were encountered: