DenialAdams / roland

Roland programming language
https://www.brick.codes/roland
Apache License 2.0
46 stars 0 forks source link

Implicit context #73

Open DenialAdams opened 1 year ago

DenialAdams commented 1 year ago

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)