eight months of coastal living: coastML status report for October 2022

Today marks eight months of coastal living; let’s checkout the running burndown chart:

This month I’ve been laying the ground work for a more industrial compiler: self-tail call elimination, forward variable declarations, and being able to call constructors & module members. I’ve also been tinkering with a piece of code I was thinking about after reading Prayers for the Crown Shy, which had a type of digital currency that I’m curious about.

One thing that has been laying heavily on me is how do we want to support ML-style modules…​ and I’m not really sure we actually want to. Looking at it, I believe that type classes are actually the way I want to go about it, but I’m not 100% sure how I want to integrate them into coastML without introducing a ton of complexity.

  1. we could use sig and mod forms, with sig stating the type class and mod stating the gn forms that satisfy it

    1. this is simple, but requires you to open or otherwise import the generic lambdas, and it is confusing for folks with ML backgrounds

    2. this would be simple to support, since mod would just act as normal

    3. does require mod to have some sort of "I’m implementing this typeclass" signifier

  2. we could support sig and have type forms implement the satisfaction

    1. this would mean type becomes more complex, but doesn’t introduce more forms

    2. gets us to the point of something like SRFI-9/SRFI-57

    3. does potentially make it easier to support downstream compilation, because each constructor could define it’s satisfaction of the type class, and these could be easily copied to say the Python class that results

    4. ends up with a halfway point between Scala’s case classes and type classes

  3. we could support sig, and have a impl that implements the satisfaction

    1. impl forms could be imported from mod easily

    2. requires yet another form, but doesn’t pollute mod or type at all

    3. once included, an impl can easily be populated into the environment

  4. regardless of which one is chosen, the compiler should support generating them for the most part, unless the user wants to override specific functionality

    1. for example, I don’t want everyone to have to write a show function

One thing that I have been thinking about as well is that originally I thought gn forms would have a sort of dynamic scope: once defined, they would exist at all levels. I’m not sure that’s the correct path; making them lexically scoped is easy enough, even tho I’m not sure if that’s a useful (will people need a generic lambda in a lexical scope often? who knows).

This next month, I want to continue to work on types, type classes, and (self-)TCO. I think this will be an important first step into making coastML an actually-useful auxiliary language.