Aarnav Jindal
Apr 26 · 6 min read

Microsoft recently released a new programming language Bosque. It was recently released as an open-source language and claims to usher in the second golden age of developments in developer tools. It expects to bring about a stark revolution in programming languages since Structured programming and Abstract Data Types changed the landscape of the industry in the 1970s. Here is what the team behind Bosque had to say about their work —

We believe that, just as structured programming did years ago, this regularised programming model will lead to massively improved developer productivity, increased software quality, and enable a second golden age of developments in compilers and developer tooling.

The language definitely brings forth some fresh ideas and since its being backed by Microsoft, it may gain traction in the coming years. So let’s take a keen look at Bosque, it’s core beliefs and philosophy and what it has to offer to developers.

The Rise of Bosque

The author of Bosque, Mark Marron, introduced a new programming model called Regularised Programming. It is inspired by the syntax and types of TypeScript and the semantics of ML and Node/JavaScript. It is typed and functional in nature. The GitHub repo for Bosque was created on 3rd of Mar, 2019, and it was published on Microsoft website on 15th of April, 2019.

It is touted to build upon the successes of structured programming and abstract data types by simplifying existing programming models into a regularised form that would eliminate major sources of errors, simplify code understanding and modification, and convert many automated reasoning tasks over code into trivial propositions.

Compilation and Support

There is currently limited support and incomplete documentation for the language ( well it released just a week ago 🤓 ). Visual Studio support is currently limited to syntax and brace highlighting. You need node installed to be able to work on Bosque currently. The code compiles down to TypeScript which further compiles down to JavaScript.

Since its heavily derived from TypeScript and JavaScript, it’ll be fairly easy for the large community of TypeScript and JavaScript to adopt the syntax and semantics of the language.

Complexities of Current Languages

The driver behind Bosque was elimination of the complexities surrounding major programming languages in the 21st century. Based on a range of experiences and sources, empirical studies identified five major sources of accidental complexity that can be addressed via thoughtful language design. These complexities are sources to various bugs which increase effort to implement functionality and maintain the code.

  1. Loops, Recursion, and Invariants
  2. Mutable State and Frames : ability to change object attribute values
  3. Indeterminate Behaviours : uninitialised variables, sort stability, map/dictionary enumeration order etc
  4. Data Invariant Violations: accessing/modifying data using index in arrays and such
  5. Equality and Aliasing: reference equality complexities

How Bosque Eliminates Complexities

  1. (Im)mutable State : Memory requirements were a great concern while developing early languages, however, with the current advances in technology memory constraints are no longer a concern. Further the use of multi-threading with mutable objects becomes a quick concern, since maintaining concurrency and consistency of state of object while several threads try to update and access it is troublesome. Thus, immutability is a great feature for new age programming languages.
  2. Indeterminate Behaviour : Bosque does not allow uninitialised variable reads. Sorting is defined to be stable and all associative collections (sets and maps) have a stable enumeration order. As a result of these design choices there is always a single unique and canonical result for any Bosque program. Decoupling the core compute language from the host runtime which is responsible for managing environmental interaction also enables elimination of environmental sources of nondeterminism.
  3. Equality and Representation : Many languages provide functions or operators to check equality like ‘.equals()’ in Java, ’==’ in C++. The concept of equality is however complex with the type specific implications for primitives, library objects and custom objects and aliasing. Equality in Bosque is defined either by the core language for the primitives Bool, Int, String, etc., or as a user defined composite key (ckey) type. This simplification eliminates the need to track aliasing, allows all values to be reasoned about as pure terms, and eliminates the need to model implicit re-entrant .equals calls during container operations.
  4. Looping Constructs : The categorisation and coverage results of the semantic loop idioms shows that almost every loop a developer would want to write falls into a small number of idiomatic patterns which correspond to higher level concepts developers are using in the code, e.g., filter, find, group, map, etc. Eliminating the boilerplate of writing the same loops repeatedly eliminates whole classes of bugs, e.g. bounds arithmetic, and makes programmer intent clear with descriptively named functors instead of relying on a shared set of mutually known loop patterns.
  5. Recursion : Bosque is designed to encourage limited use of recursion, increase the clarity of the recursive structure, and enable compilers/runtimes to avoid stack related errors. The language takes a similar approach to async/await syntax and semantics from JavaScript/TypeScript by introducing the rec keyword which is used at both declaration sites to indicate a function/method is recursive and again at the call site so to affirm that the caller is aware of the recursive nature of the call. In addition to the standard unbounded call stack implementation the rec keyword can be used like the await keyword as a marker for points where conversion to a continuation passing version can be performed, with a work list implementation, to enable recursion on a bounded depth stack.

Exciting New Features

  • Bulk Algebraic Data Operations : Bulk algebraic operations in Bosque support bulk reads and updates to data values. In most languages this would need to be done on a field-by-field basis.
  • Typed Strings : Typed strings provide a novel mechanism for lifting known structure about the contents of a string into the type in a way that is meaningful to humans and that can be used by the type checker.
  • Flexible Invocations : Bosque provides named arguments along with rest and spread operators. These can be used to perform simple and powerful data manipulation as part of invocations and constructor operations.

Conclusion

Despite trying to be a fresh breath of air in the ever growing collection of programming languages, Bosque didn’t excite me enough as a programmer to switch from JavaScript. Some novel ideas implemented show potential, and since the language is still in its infancy, it may evolve in the coming future or pave way for upcoming new languages. Microsoft’s internalising and using Bosque for application development may help it get some following like with Go by Google and Thrift by Facebook. You can see the complete documentation for the language at the Github Repo link below.

What do you think about the languages new ideas ? Do comment your views below. Don’t forget to drop some claps if you liked the article. Let me know what else I should cover in my future articles. Till then, keep geeking it out 🤓.

Aarnav Jindal

Written by

Avid programmer chasing developments in the dynamic and invigorating world of technology 🤓

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade