Microsoft introduces new programming language, Bosque

Microsoft recently introduced a new programming language, Bosque, which references the syntax and types of TypeScript, as well as the semantics of ML and Node/JavaScript. Author Microsoft computer scientist, Mark Marron is dedicated to eliminating the complexities that arise during programming and creating the language Bosque that he believes goes beyond mainstream structured programming.

“The Bosque programming language is a Microsoft Research project that is investigating language designs for writing code that is simple, obvious, and easy to reason about for both humans and machines. The key design features of the language provide ways to avoid accidental complexity in the development and coding process. The result is improved developer productivity, increased software quality, and enable a range of new compilers and developer tooling experiences.”

Specifically, existing programming has been simplified, becoming a standardized form, eliminating the main source of uncertainty. Based on a series of analysis, experience, and validation of runtime and programmer development, and interviews with developers, the “Regularized Programming with the BOSQUE Language” paper identifies five major sources of uncertainty in the development process:

Mutable State and Frames: Mutable state is a deeply complicated concept to model and reason about. The introduction of mutability into a programming language destroys the ability to reason about the application in a monotone [56] manner which forces the programmer (and any analysis tools) to identify which facts remain true after an operation and which are invalidated. The ability for mutable code to affect the state of the application via both return values and side affects on arguments (or other global state) also introduces the need to reason about the logical frame [47, 64] of every operation. Section 4.1 examines how the BOSQUE language eliminates this source of complexity through the use of immutable data representation.

Loops, Recursion, and Invariants: Loops and recursion represent a fundamental challenge to reasoning as the code
describes the effects of a single step but understanding the full construct requires generalization to a quantified property over a set of values. Invariants [19, 27] provide the needed connection but a generalized technique for their computation is, of course, impossible in general and has proved elusive even for restricted applications. Section 4.5 examines how BOSQUE handles the invariant problem by eliminating loops and restricting recursion.

Indeterminate Behaviors: Indeterminate behaviors, including undefined, under specified, or non-deterministic or environmental behavior, require a programmer or analysis tool to reason about and account for all possible outcomes. While truly undefined behavior, e.g. uninitialized variables, has disappeared from most languages there is a large class of underspecified behavior, e.g. sort stability, map/dictionary enumeration order, etc., that remains. These increase the complexity of the development process and, as time goes on, are slowly being seen as liabilities that should be removed [9]. Less obviously the inclusion of non-deterministic and/or environmental interaction results in code that cannot be reliably tested (flakey tests), behaves differently for non-obvious reasons,
and frequently mixes failure logic widely through a codebase. Section 4.2 explains how BOSQUE eliminates these sources of complexity by fully determinizing the language semantics and Section 4.4 further simplifies issues around evaluation orders.

Data Invariant Violations: Programming languages generally provide operators for accessing, and in imperative languages updating, individual elements in arrays/tuples or fields in objects/records. The fact that these accessors/updaters operate on an individual elementwise basis results in programmers updating the state of an object over multiple steps, or manually exploding and object before creating an updated copy, during this span invariants which normally hold are temporarily invalidated before being restored. During these intervals the number of details that must be tracked and restored can increase drastically increasing opportunities for mistakes and oversights to occur. Section 4.1 shows how the BOSQUE language eliminates this problem through the introduction of algebraic bulk data operators.

Equality and Aliasing: Programming languages live at the boundary of mathematics and engineering. Although language semantics are formulated as a mathematical concept there are common cases, e.g. reference equality, pass by-value vs. by-reference, or evaluation orders, that expose and favor one particular hardware substrate, generally a Von Neumann architecture, either intentionally for performance or accidentally by habit or history. While seemingly minor these choices have a major impact on comprehensibility – merely exposing reference equality pulls in the complexity of reasoning about aliasing relations and greatly complicates compilation on other architectures. Section 4.3 shows how the BOSQUE language eliminates reference equality and, as a consequence, eliminates the complexity of aliasing questions and by-value vs. by-ref argument passing issues.

Bosque comes from the idea of ​​standardized programming, just to solve the problems encountered in the current structured programming. The author regards the rise of structured programming as the first golden age of programmers and development tools. This standardized programming model will greatly improve the productivity of developers, improve the quality of software, and bring the second golden age of compilers and development tools.

Bosque programming language has hosted on Github.