Coding 2023-08-09

Tags:
By Max Woerner Chase

I wrote some sample programs in a possible syntax for NABTO. There are various things that are likely to need to change:

I think what I need is something like... There are a bunch of type constructors that package record/variant/whatever types together with information related to resumption, and defining an effect consists of somehow associating a record type and a constructor together, and handling an effect consists of having a modified match statement that unpacks the resumption information. (Maybe there's some kind of automatic casting between different effect constructors?) Anyway, to perform an effect, the code needs to construct the data type associated with the effect, and then the runtime somehow determines which kind of effect wrapper to use... Although, that information would be ambiently available at runtime... Doing that would foreclose a number of desirable optimizations...

If I want to get the optimizations, then I need to be able to make a statement something like "from a type level, this type is guaranteed not to capture beyond this level of detail".

Wait... Maybe there could be an overloaded function, and then defining an effect can be done by setting up a modular implicit that associates the data type to the specific effect construction machinery. I'm not sure what the right way to approach this from an ergonomic perspective would be, but I think this can work. It conceals some weird footguns, but I think people would need to try to find them, so it's probably fine.

This has been a productive night, and I should wrap up.

Good night.