| I've spent the last few weeks building SFX in Rust. It's a programming language experiment focused on context-oriented programming with some unusual design choices. Reality check first: Solo project, 53 commits 1 GitHub star xD Zero users besides me No production usage Documentation is aspirational Many stdlib modules are minimal stubs What actually works: Basic interpreter (tree-walker) Arbitrary precision decimals (0.1 + 0.2 = 0.3) 1-based indexing (controversial, I know) Context/Situation system (the main idea) Some file I/O and basic networking JIT hooks exist but optimization is minimal The Context idea (asking for feedback on this): Instead of checking if (user.isAdmin) everywhere, you define Situation: AdminMode that overrides methods: Concept: User
To GetPermissions:
Return "read"
Situation: AdminMode
Adjust User:
To GetPermissions:
Return "admin,write,delete"
Story:
Create User Called Bob
Switch on AdminMode
Print Bob.GetPermissions # Now returns "admin,write,delete"
Objects change behavior based on active situations without mutating state. Is this useful or just overengineered?What's NOT ready: Performance is terrible (haven't optimized anything) Standard lib is mostly TODOs AI features are vaporware REPL doesn't exist No tooling (LSP, debugger, etc.) Tests exist but coverage is poor My questions: Is context-oriented programming solving a real problem or creating busywork? Should I focus on making it fast OR making the stdlib useful? Is 1-based indexing a dealbreaker for you? Would arbitrary precision by default bother you for a general-purpose language? I'm not trying to replace anything. This is a learning project that got out of hand. Repo: https://github.com/roriau0422/sfex-lang Pages: https://roriau0422.github.io/sfex-lang/ Honest feedback wanted - including "this is pointless, stop wasting time." |
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?