Interview Microsoft has introduced a new open source programming language called Bosque that aspires to be simple and easy to understand by embracing algebraic operations and shunning techniques that create complexity.
The structured programming paradigm, in which flow control is managed with loops, conditionals, and subroutines, became popular after a 1968 paper titled "Go To Statement Considered Harmful" by computer scientist Edsger Dijkstra.
Marron believes we can do better by getting rid of sources of complexity like loops, mutable state, and reference equality. The result is Bosque, which represents a programming paradigm that Marron, in a paper he wrote, calls "regularized programming."
"This model builds on the successes of structured programming and abstract data types by simplifying existing programming models into a regularized form that eliminates major sources of errors, simplifies code understanding and modification, and converts many automated reasoning tasks over code into trivial propositions," Marron explains in his technical paper.
The GitHub repo for the language contains many more examples.
In an email interview with The Register, Marron said reference equality - when two variables point to the same object in memory - represents an example of the kind of complexity that can cause problems.
"It seems very simple but once you have [reference equality] in the semantics you must constantly think about it along with the pointer aliasing relation it introduces," he said. "One of my favorite papers on aliasing is from 2001 titled 'Pointer Analysis: Haven't We Solved This Problem Yet?' and here we are in 2019 with the pointer aliasing problem is definitely still not solved."
As an example, Marron describes a method that previously always returned a new object, one that you'd like to optimize so it returns a new object, as a singleton pattern or from a cache.
"In a language where objects have identity, this could change the behavior of the program," he said. "However, in Bosque which does not allow object identity, this sort of change is always safe."
"In theory this seems like a trivial thing, but in practice it meant that every time a developer sorted a list they had to remember that it was unstable and take into account the possible reordering of values with the same sort value. Chromium bug 90 was opened in 2008 with a sort stability problem and, before it was finally closed last year to much fanfare, this bug had over 1700 comments."
Marron's technical paper explores potential sources of programming language complexity that Bosque tries to deal with. But he says eliminating mutable state, loops, and reference equality represent the big three.
"In the academic literature the associated problems of strong-updates, loop-invariants, and alias analysis have been all been worked on extensively for 30+ years and still remain large open problems," he said. "By eliminating these features, and the need to solve the associated problems, many things like symbolic-execution reduce down to conceptually simple tasks (as first described by Floyd, Hoare, and Dijkstra)."
Marron says the initial goal for Bosque is to build automated zero-effort code validation, automated SemVer checking, and compilation to use SIMD hardware, such as AVX or SSE. "At this point we have only done this by hand on small examples but, fundamentally, there don't appear to be any insurmountable obstacles to practical implementations," he said.
At the moment, Marron sees Bosque as a way to explore language design choices and to help create automated developer tools like verifiers and compilers through collaboration with academic and online developer communities.
"The hope is to use Bosque as a proof of concept for various ideas in this space," he said. "In the future we may work to move these ideas into production in some form."
Presently, Bosque relies on an interpreter written in TypeScript, run on Node.js, as a reference implementation. Looking ahead, Marron intends to implement ahead-of-time compilation for WASM and native code. In the coming months, he said, he's going to focus on filling out the various TODO items, bug fixes, and developing features that will support writing larger programs in the language.
He said he has two interns this year, from the University of New Mexico and the University of Colorado Boulder, who will be focused on more advanced developer tooling experiences, like verifying applications are free of runtime errors without additional programmer effort and automatically setting bounds for memory usage over time.
If Bosque finds a place in the development ecosystem outside of academic experimentation, Marron believes it may be in the cloud or IoT space since Bosque code can be compiled into a small footprint, can start quickly, and can be verified for correctness through symbolic analysis. ®