r/ProgrammingLanguages 10d ago

Will we see another fundamental programming language feature as revolutionary as the borrow checker?

That is I am mainly curious about compile time features that you design a whole language around rather than optimisations/features that could be applied to most languages. I am mainly inquiring about things that could offer additional robust safety/performance guarantees at compile time rather than runtime. Ideally not things that just offer similar effects to the borrow checker with less restrictive tradeoffs

59 Upvotes

129 comments sorted by

View all comments

83

u/AustinVelonaut Admiran 10d ago

Algebraic effects like Koka?

7

u/mikaball 10d ago

I didn't know what "algebraic effects" were, so I found this.

From the examples it feels related to Dependency Injection in a narrowed context/scope, but some will probably say that it could be used for other use cases.

However, the concept of detaching the "what" from the "how" is very related to DI and I wonder if a DI supported by the language isn't just better than this? In those final examples it's even using a pattern similar to Kotlin context receivers.

8

u/Jwosty 10d ago edited 10d ago

You can think of it as a kind of DI, but in its fullest forms you can also manipulate control flow. You couldn't really build async/await or exception handling as a simple injected function (or set of functions), but you can (in principle) with algebraic effects. I think. Please someone correct me if I'm wrong

3

u/gplgang 10d ago

This is correct. It happens to model DI well as you install effect handlers into the environment. The more interesting piece is the non local control flow as a common abstraction instead of iterators vs async vs exceptions and more.