About Me

by Marcel Garus · 1 minute read · available at mgar.us/me

I'm a student at the Hasso Plattner Institute, and I develop open source thingies.

I'm open to getting to know new people. So, if you want to talk, these are ways to contact me, sorted in my preference order:

Thanks for reading!

If you liked this article, feel free to share it using this shortlink:

By the way, I wrote other articles about interesting topics. Here's an article I recommend:

Mehl: A Syntax Experiment

2022-05-21 · 5 minute read · programming language design

Roughly speaking, there are two ways to describe data transformations:

  • top-down: you first start with a high-level overview of the dataflow

  • bottom-up: you describe what exactly you do with data and build up abstractions as you go along

Most programming languages enable both styles of representing data transformations. On a small scale, those styles usually happen in the form of function calls or method calls, respectively. For example, here's a prototypical program that sums a list and then calculates the sinus of the result:

sin(list.sum)

Some function calls are written in a top-down f(x) fashion, others in a bottom-up x.f style. A few languages, such as Nim, even support a Uniform Function Call Syntax, so that you can use both styles equivalently. Other languages, such as Lisp, enforce one style over the other:

(sin (sum list))

Interestingly, almost no language enforces a bottom-up style. A notable exception is shell scripting, where it's common to use the pipe operator | to pipe data from one program into the next:

ls | grep foo

This resembles how I intuitively think about source code with lots of data manipulation. For me, the description "sum the list, then take the sinus of that" feels less complicated than "take the sinus of the sum of the list." Especially for longer function chains, the bottom-up approach allows you to mentally simulate the data flowing through the program as you read the code, while the top-down approach results in a mental stack overflow.

So, what would a programming language look like that enforces a bottom-up style?