|
|
|
|
|
by iroddis
202 days ago
|
|
Congrats on the progress thus far! I love aspirational languages, so please keep going. That being said, as someone who struggles with maintaining large amounts of context when I’m debugging, I’d find context-specific execution hard to follow and debug. As a concrete example, the switch to an Admin context could appear far away from the call to GetPermissions without any obvious way to figure that out. Contexts end up being a sort of global state. If you continue with this route, it would be nice if there was a way to print out the stack of the current contexts in play and where they were set in the code. Are contexts scoped at all? Can they be layered? |
|
To solve this, SFX treats the Context Stack as Explicit Data, not hidden magic.
1. Debugging: Because the runtime knows exactly what 'Reality' is active, we can print it. We are building a `Context.Trace()` tool that outputs something like: `[Base Reality] -> [HolidaySale] -> [AdminMode]` This tells you exactly why a method is behaving the way it is.
2. Layering: Yes, contexts are strictly layered (LIFO stack). If you activate `Situation A` then `Situation B`, the runtime checks `B` first, then `A`, then the Object itself. This allows for 'Behavioral Inheritance'—you can compose behaviors (e.g., `LoggingMode` + `SafeMode`) dynamically.
3. Scoping: Right now it is imperative (`Switch on/off`), but because SFX is indentation-based, we are working on block-scoped contexts for the next release:
Thanks for the encouragement.