You are viewing archived messages.
Go here to search the history.

Jimmy Miller 2024-10-14 16:11:32

I've not posted her in a bit partially because it feels like the work I'm doing is a bit "present-company". I put my editor on pause because I hate all languages I could write it in. I want a good dynamic language where I can develop the editor in itself without ever restarting it. I want something multi-threaded. I want something with a lightweight runtime. But ultimately, I really just want to boil the ocean and this feels like a fun way.

So I've been making my own language. It is a dynamically typed functional language that compiles straight to machine code (no vm at all). Today, I finally got my persistent vectors properly working (After finally figuring out that my bug was in the gc (still not fixed) not my implementation.) I decided as an experiment to implement clojures HAMT based persistent vectors into the language itself (not at the compiler/runtime level). In fact, even my mutable arrays are implemented in the language with a primitive allocation function and some fetching "fields" primitives.

Sadly my implementation is about 6x slower than clojures on my artificial benchmark. But honestly that's pretty darn good! I have done 0 optimizations, Clojure's data structures are all implemented in java. That means I'm about 6x slower than java on this benchmark. Not bad. Trying to figure out next if I want to do some performance work, or continue building out features.

Mariano Guerra 2024-10-14 17:16:15

please share some high level design notes 🙂

Mariano Guerra 2024-10-14 17:16:21

(if you want 😄)

Jimmy Miller 2024-10-14 19:03:24

The whole thing is premised on the idea that there are no* popular, modern dynamically typed languages. Javascript, python, and ruby are all decades old and are showing their age. Clojure and Elixir are the only contenders. Clojure will never be popular because it is a lisp. Elixir's super power and its limitation is the beam.

Python, ruby, and javascript all lack a good story on multi-threading. Ruby and python are slower than they ought to be. All of them are OO inspired. I think functional langauges + Rust have shown a different way of programming. All of them have weird quirks and problems around packages/modules/scoping, things we've since learned to do better. Finally, they have bad tooling for inspecting performance, memory, usage etc.

All of this is the situation I'm designing into. I want to build something that

1) Can be popular (so no lisp)

2) Can be fast (so focusing on performance from the beginning, no slow interpreter)

3) Has good module/namespace support

4) Is multi-threaded

5) Is lightweight (does not depend on a big existing platform)

6) Has great performance and memory tooling support

As for the actual code design. I've started from the ground up with a aarch64 machine code generator. I have an IR that is an infinite register machine. An AST on top of that. I've implemented 3 different GC systems (Mark and Sweep, Compacting, and a simple generational collector).

That's quite a bit, so happy to answer any questions

Mariano Guerra 2024-10-14 19:28:32

is it immutable all the way, immutable first or mutable first with immutable support?

Mariano Guerra 2024-10-14 19:29:19

the multithread support is going to be raw "pthreads"? or some core abstraction like actors, channels etc?

Mariano Guerra 2024-10-14 19:29:57

any esoteric inspirations?

Jimmy Miller 2024-10-14 19:30:11

The goal is that people will write immutable code. But I’m going to be fairly pragmatic in that regard. It will be very similar to Clojure. There will be ways to write mutable stuff. But everything is pushing you to write immutable stuff.

Jimmy Miller 2024-10-14 19:31:28

Multithreading as in system threads. The language should be flexible enough that anything more than that should be able to be written in user land. Still flirting with the idea of delimited continuations in the base language. Which would give you all the power you need for anything like that.

Jimmy Miller 2024-10-14 19:33:53

The most esoteric inspiration I can think of is pyret. Just like pyret I plan on having nice support for algebraic data types (but not trying to do their gradual type stuff) and first class ways of doing tests.

Really this is clojure + rust + batteries included. Those are the main inspirations.

Paul Tarvydas 2024-10-14 19:44:51

FYI - in places where you can guarantee stack-based immutability, you might consider using Jart's ABC garbage collector. She does it in 40 bytes. YMMV.

Kartik Agaram 2024-10-17 18:57:41

I just want to say, I think:

a) This feels like future not present.

b) #devlog-together is agnostic to future vs present. It's a space for anything you want to share.

Tom Larkworthy 2024-10-17 04:45:14

Been woking on my malleable Observable project. I can now select and edit cells from userspace. A fair amount of work went into decompiling a runtime variable back to its (near) original source code representation.

image.png

Kartik Agaram 2024-10-18 17:18:53

I've been thinking about Potluck and 💬 #linking-together@2024-10-16. Potluck describes 3 mechanisms:

  • extracting data using (regex) patterns
  • performing computations on that data
  • showing results of computation as annotations

My notebook app does simple variants of 2 and 3, and replaces 1 with explicit in-document markup.

Now I'm playing with another approach to 1. I already have the idea of pivots from 💬 #devlog-together@2024-10-08. Putting two of those pivots together should yield a range that adjusts in intuitive ways in the presence of edits. Think of a range as something like a hyperlink you add to a comment in a UI like this Slack app we're in right now:

  • Inserting/deleting text before a range moves it.
  • Inserting/deleting text after a range leaves it unchanged.
  • Inserting/deleting text within a range grows/shrinks it.
  • Deleting text at a boundary shrinks the range, and only deletes the attached attributes if the range becomes empty. This makes ranges more robust to deletion than my doodles attached to a single pivot.
  • Inserting text at boundaries can't always do what you want. I imagine it'd be nice to have handles that you can drag to adjust a range.
Jack Rusher 2024-10-18 20:38:04

I think I’ll need to feel this to know what I think about it

Kartik Agaram 2024-10-18 20:55:32

Try it out, you mean? I'll send you something.

Would you also like to try out the doodle app or notebook app I alluded to?

Tom Larkworthy 2024-10-20 19:57:06

Full round trip decompilation <--> compilation between Observable runtime and my in-notebook editor is working. I've put a CodeMirror UI on it and smooshed it into a single cell for easy import. works on mobile. A few areas are broken: imports, anonymous cell editing and adding variables. Note I am sticking to Observablehq flavoured JS, but it could support any language if you have a compile to JS for it.

image.png

Kartik Agaram 2024-10-21 04:19:20

I don't quite get what I'm looking at. Is this not running at observablehq.com?

Tom Larkworthy 2024-10-21 06:54:24

It is an observable cell running inside observable that can edit other cells in the notebook without going through Observable's editing interface. ie.. if I export the enclosing notebook, it retains this editor.

Its like Obseservable, but implemented in userspace. Sorta pointless if all you want to do is use Observbalehq notebooks in the expected workflow, but quite powerful if you want to edit off platform (if there was a method to persist the results), or do program synthesis (its scriptable). Thats the plan anyway, still a WIP (hence only a devlog entry)