4 ms·
Solving the Expression Problem in Go
- KyleSanderson 3y agoNot diminishing the article at all, there's massive value I've gained from leveraging this runtime solution in multiple projects: https://github.com/antonmedv/expr https://github.com/antonmedv/expr The language is easy enough for people to pick-up.
- tgv 3y agoThat addresses an entirely different problem.
- samsquire 3y agoI think the expression problem is still unsolved to the extent I would be satisfied. It's actually my hobby to think about it. But I think an interesting part of the problem is this: things interact and how to represent the cases you care about. Sum types? What happens if a user combines features that generates an AST that looks this way? [0] What are all the interactions between these AST nodes? You want to support Windows, Linux, Mac that's three variations for everything you do. Some of your platform APIs might work differently. Some APIs might be push-driven or pull-driven. Async in Rust and lifetimes interacts with the type system. Pony has types that determine memory shareability. Your framework might use an online/incremental algorithm or a all-in-one-go control flow. Garbage collection interacts with threading. What if someone switches applications when logging into their bank? Or switches apps to type in a password from a password manager? Or if someone switches app to use their payment card online verification? (In my experience, the session invalidates due to disabling of caches) Programming languages force our hand into elaborate design patterns such as Java design patterns, IoC containers. The C++ specification. When all we want to do is define X to happen when Y happens. Define an interaction. People like sum types and pattern matching for dispatch which helps but doesn't solve the problem: interactions between things (potentially of different types) I have talked about version interactions between old versions of software and new versions of software and in distributed systems when you want to upgrade an RPC call to use a different schema and field. We as an industry keep reinventing the same solution: compartmentalisation to contain the interactions, create a noun to solve it but introduce a thousand more interactions: processes, Kubernetes pods, Docker containers, Hypervisors, microVMS, WASM runtimes, virtual machines. Or abstraction layers, hardware abstraction layers, operating systems. Look at text editor APIs, typesetting or CSS. SQL query combinations. Then you want a thin waist to solve the N×M problem which is what the expression problem is about. EDIT: I've just realised that abstraction is about restricting interactions. The Internet Protocol stack or OSI model. [0]: https://rachit.pl/post/you-have-built-a-compiler/ https://rachit.pl/post/you-have-built-a-compiler/
- Fire-Dragon-DoL 3y agoInteresting! I'm ignorant on the topic, but the other day I was thinking of something similar due to my obsession with tagging. So a simple thought is "we program with files and classes and need to figure out single name for things, but then we want to use things in many places, what if we had group of tags attached to things and features were made using group of tags to find the things needed to make the feature ". No idea how it would end up, probably a mess. The main thing was realizing we are bound to a bunch of things that really could be drastically limiting us.
- elcritch 3y ago> We as an industry keep reinventing the same solution: compartmentalisation to contain the interactions, create a noun to solve it but introduce a thousand more interactions: processes, Kubernetes pods, Docker containers, Hypervisors, microVMS, WASM runtimes, virtual machines. Rumor has it that dark matter is just advanced aliens doing the same thing with quantum computing. Except with infinite quantum recursion it takes on extra mass due to twisting of the spacetime fabric, creating dark matter. Pulsars are actually just "Microsoft Tuesday" updates. :P
- iwwr 3y ago> The goal is to define a datatype by cases, where one can add new cases to the datatype and new functions over the datatype, without recompiling existing code, and while retaining static type safety (e.g., no casts). Isn't this made moot by the prevalence of static linking or fat binaries in go-land?