← Back to context

Comment by keithnz

1 month ago

Vibe-coded a YouTrack CLI tool in < 1 hour:

https://github.com/keithn/yt

Also working on a language for embedded bare-metal devices with built-in cooperative multitasking.

A lot of embedded projects introduce an RTOS and then end up inheriting the complexity that comes with it. The idea here is to keep the mental model simple: every `[]` block runs independently and automatically yields after each logical line of code.

There is also an event/messaging system:

- Blocks can be triggered by events: `[>event params ...]`

- Blocks can wait for events internally

- Events can also be injected from interrupts

This makes it easy to model embedded systems as independent state machines while still monitoring device state.

Right now it’s mostly an interpreter written in Rust, but it can also emit C code. I’m still experimenting with syntax.

Example:

    module WaterTank {
      type Direction = UP|DOWN
      let direction = UP
      let current = 0

      [>open_valve direction |> direction]
      [>update level |> current]

      [
        for 0..30 |> iteration {
          when direction {
            UP   -> !update level=current + 1 |> min(100)
            DOWN -> !update level=current - 1 |> max(0)
          } ~
          %'{iteration} {current}'
        }
      ]

      [>update level |> when {
          0..10  -> %'shallow'
          11..15 -> %'good'
          16..   -> %'too much!' then !open_valve direction=DOWN
        }
      ]
    }

> automatically yields after each logical line of code

I've become more and more interested in code that yields (coroutines etc, read this fascinating article on HN just a couple of days ago: https://willhbr.net/2026/03/02/async-inject-and-effects/ )

Can you share more about this? How the async model works? Why it does -- is it a performance guarantee given the RTOS comment? Or is it more about the state machine idea, and how or why does yielding every line (not, say, every state transition, though I have no idea if or why that would be more useful) relate to that?

I mostly just have lots of questions because it sounds fascinating, so if you're looking for an excuse to talk about it, please count this as that excuse!

  • The idea is not so much any kind of hard real time guarantee (in practice it switches quickly so it is soft realtime) but what you often have when doing bare-metal embedded systems is a lot of parallel state machines, not necessarily because the state machine is the best mechanism it's more because you want things to happen in parallel in C/C++, this can be annoying to deal with so you end up with these statemachines that don't block, you cycle through them, and you get "parallel" operation, but anything can block other statemachines, and things like long running for loops need to be broken into non blocking states. I've often thought an Actor Model like thing would be really nice if baked into the language and that the actors were all "live" such that were all processing in parallel and firing off events as needed which is how I started this. I initially was thinking switching on something like state transitions / explicit yields but every statement yielding automatically lets you run multiple "forever" loops which in turn might have long running for loops (like updating a display) statement switching means you don't have to worry about when to yield. Instead I reversed it and figured it would be nicer to define things that need to run as an atomic operation as that seems to be less frequent. This way you generally don't need to worry about blocking and it feels like it's programming as if it was pre-emptive multitasking. Multiple little programs all concurrently running and firing off events to communicate with each other

holy, downvotes on what I'm working on?

  • You said "vibecoded", maybe it triggered someone. I upvoted you as I just learned YouTrack exists, and it has 10-users free plan, I'm going to give it a try,

    • YouTrack is pretty good in that is easy to plan and manage work across multiple projects. Jetbrains made it years ago when they got frustrated with Jira for managing their projects. For most of their products (IntelliJ, Ride, Webstorm, Datagrip, etc) if you want to raise a bug you raise it in their YouTrack. It is super customizable and has a reasonable API. Only thing I find is their website is a bit sluggish. The API is pretty quick though, so the CLI tool is reasonably snappy.

  • Yeah it's a nice project. Maybe it was an accidental click by somebody. I tried to compensate for it.