r/ProgrammingLanguages • • Jul 23 '26

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

61 Upvotes

127 comments sorted by

View all comments

Show parent comment

1

u/PressureBeautiful515 Jul 25 '26

Command–query separation

Limiting when designing concurrent data structures, e.g. for a stack you want to be able to pop (side-effect, command) and return the popped value, unless the stack is empty (pure query) and for all this to be in one atomic operation.

1

u/Inconstant_Moo 🧿 Pipefish Jul 26 '26

I'll need to look into that. Anything that says it's "well-suited to the object-oriented methodology" can't be quite the same as what I'm doing, which really isn't. And yet the separation is the same, and there are the same benefits they refer to of being able to put whatever validation logic you like on a type (and a whole lot of other benefits too).

Apparently the Eiffel people saw this as a way of making imperative languages sane, whereas I thought I was making functional languages accessible.

In a functional language we wouldn't do what you describe with the stack --- we'd have a function which returns the value and the stack with its head popped off. If we wanted to update the value of a stack contained in a global variable, that would be a command, as updating global state always is.

var

mystack = []

cmd

doPop :
    poppedValue, myStack = pop myStack
    post "popped " + string(poppedValue)

def

pop(s list) :
    s[0], s[1::len s]

Re concurrency, it's actually my hope to keep the users' fingers out of it. The language is based around a request-response model, so the plan is that the runtime should take care of making that concurrent with the user just setting the configuration.

1

u/Inconstant_Moo 🧿 Pipefish Jul 26 '26

I've looked at Eiffel and the difference is that because Meyer was working in OOP, he's making this distinction between the methods you can define on objects. In Pipefish there are only immutable values, and the distinction is between the commands and the functions of a service/library/app. In fact in Pipefish a service looks very like an object, that's the level at which the encapsulation lives, and the only thing that can own mutable state, and, in this instance, the level at which we separate queries and commands.

Which is often how OOP ends up anyway: we have lots of little PODOs, and then a big singleton with a bunch of mutable state and a public-facing API.