Drop #163 (2022-12-22): Twelve Days of [Quick] Drops • Day 11

Unison; Koka; Vale

On The Eleventh Day Of Quick Drops 🎅🏽hrbrmstr🎅🏽 Gave To Me…

🎶 New Languages A-Brewing 🎶

(If this is your first Xmas Quick Drop, head back to Day 01 to find out what’s going on.)


“Back in my day” programming language creation pace was slow and steady. Sure, compsci academics needed to keep creating new ones to warrant cranking out middling-quality papers (which, tbh, I’m increasingly realizing are mostly the academic versions of TPS reports). Today, programming language creation is fairly democratized, which has led to a nigh flood of new ones cropping up, seemingly, daily.

Today’s Quick Drop is appropriately named as it’s ’s bday & .1 has consumed virtually every free cycle his pampa can muster. So, here are three languages I’m keeping an eye on (two of them, as often as I can spare), and just haven’t gotten around to featuring in previous drops.

Unison

Unison [GH] is my fav amongst the three. This is why:

Each Unison definition is identified by a hash of its syntax tree.

Put another way, Unison code is content-addressed.

Each Unison definition has a unique and deterministic address (its hash) in this vast immutable address space. Names are like pointers to addresses in this space. We can change what address a name points to, but the contents of each address are forever unchanging.

This starting assumption provides some surprising benefits: it simplifies distributed programming, eliminates builds and dependency conflicts, supports typed durable storage, structured refactorings, enables better tools for working with code, and lots more. Let’s go over how each of these benefits emerges.

Hit the link for a deeper dive into the deets, and this link for those who like to get right to the code.

Koka

While promiscuous object [type] [re]assignments may be great for capricious Python developers (OK, mebbe R folks, too), strongly typed languages are just plain safer (*prepares for hate mail*). Furthermore, functional-style languages tend to flow and read better.

As such, I’m kinda hoping Koka [GH] concepts evolve into a generational leap in some other existing languages (some are close, now, tho).

The core of Koka consists of a small set of well-studied language features, like first-class functions, a polymorphic type- and effect system, algebraic data types, and effect handlers. Each of these is composable and avoid the addition of “special” extensions by being as general as possible.

Koka tracks the (side) effects of every function in its type, where pure and effectful computations are distinguished. The precise effect typing gives Koka rock-solid semantics backed by well-studied category theory, which makes Koka particularly easy to reason about for both humans and compilers.

Effect handlers let you define advanced control abstractions, like exceptions, async/await, iterators, parsers, ambient state, or probabilistic programs, as a user library in a typed and composable way.

Perceus is an advanced compilation method for reference counting. This lets Koka compile directly to C code without needing a garbage collector or runtime system! This also gives Koka excellent performance in practice.

Perceus also enables reuse analysis and lets Koka optimize functional-style programs to use in-place updates when possible.

For those who just want code samples: here ya go!

Vale

https://en.wikipedia.org/wiki/Blackmore_Vale#/media/File:Hambledon_Hill_and_Child_Okeford_20080714.jpg Permission details  This file is licensed under the Creative Commons Attribution 2.0 Generic license. You are free: to share – to copy, distribute and transmit the work to remix – to adapt the work Under the following conditions: attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. This image was originally posted to Flickr by MarilynJane at https://www.flickr.com/photos/71153021@N00/2668938610. It was reviewed on 10 March 2010 by FlickreviewR and was confirmed to be licensed under the terms of the cc-by-2.0.View more  CC BY 2.0view terms  File:Hambledon Hill and Child Okeford 20080714.jpg  Created: 14 July 2008

Who wouldn’t want a language that is fast, safe, and easy?

Vale [GH] is an ahead-of-time compiled to LLVM, statically typed, and uses a new generational references technique for memory safety with speed and flexibility, and will soon have region borrow checking to make it even faster.

Features include:

  • Single Ownership and move semantics without needing a borrow checker.

  • Higher Resource Acquisition Is Initialization (RAII), which helps in remembering to call any function at some point in the future.

  • Statically Typed with type inference.

  • Memory Safe with generational references

  • Generics and const generics

  • Universal Function Call Syntax

  • Mutable and Immutable Objects

  • Patterns with de-structuring

  • Regions for different allocation strategies. (planned!)

  • Interface Constructors (planned!)

Dive right into the code.

FIN

Speaking of programming languages, Andrew Healey decided to use 2021’s Advent of Code to design a new programming language. Check out Adventlang after reading through the blog/diary. ☮

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.