Stream: platform development

Topic: scottc/roc-platform-patcher - "Alter & tailor platforms."


view this post on Zulip Scott Campbell (Oct 30 2026 at 09:38):

"Alter & tailor platforms."

https://github.com/scottc/roc-platform-patcher

So for example... roc-lang/basic-cli@0.26.0

Let's say you wanted to instrument the effects, and have an effects monitoring dashboard... with the ability to observe & alter effects. Or monitor memory allocations etc. Inject any kind of middleware.

Replace effects with noops stubs, crashes, alternative hotswappable dynamic dlopen behaviour.

Or generate mock function calls, fuzzing, in both directions.. towards the app and towards the platform etc.

Or even delete or add platform apis... useful for hardening, or expanding platform functionality, so apps can have access to more or less apis.

Inject dev tooling... display a GUI or websever with various dashboards & tools.

Well now you can do that... automatically & generically across any platforms.

The repo is just a small trivial example of what is possible.

view this post on Zulip Scott Campbell (Oct 30 2026 at 09:38):

How it works:

roc app/rpp.roc -- \
  --input=GddgvsGjiNXrHFW6au5i5dUDbTs8FinQdrgE2Gqmw53t.tar.zst \
  --output-dir=patched
main! : List(OsStr) => Try({}, _)
main! = |args| {
    config = parse_args(args)

    Stdout.line!("roc-platform-patcher (rpp) v0")?
    Stdout.line!("  input:  ${config.input}")?
    Stdout.line!("  target: ${config.target}")?
    Stdout.line!("  work:   ${config.work_dir}")?
    Stdout.line!("  out:    ${config.output_dir}")?

    unpack!(config)?
    symbols = inspect!(config)?
    rename_originals!(config, symbols)?
    generate_proxies!(config, symbols)?
    rebuild!(config, symbols)?
    write_metadata!(config, symbols)?
    repack!(config)?

    Stdout.line!("")?
    Stdout.line!("Done. Point an app at: ${config.output_dir}/")?
    Stdout.line!("Treat the result as a debug build.")?

    Ok({})
}

view this post on Zulip Scott Campbell (Oct 30 2026 at 09:38):

roc-lang/basic-cli roc_alloc monitoring:

(poll ~0.5s)

 {"roc_alloc":{"calls":26451196,"total_ns":966265338},"roc_dealloc":{"calls":26450932,"total_ns":908211319},"roc_realloc":{"calls":0,"total_ns":0}}

 {"roc_alloc":{"calls":26870732,"total_ns":980522106},"roc_dealloc":{"calls":26870463,"total_ns":921647486},"roc_realloc":{"calls":0,"total_ns":0}}

 {"roc_alloc":{"calls":27301462,"total_ns":994581860},"roc_dealloc":{"calls":27301189,"total_ns":934940749},"roc_realloc":{"calls":0,"total_ns":0}}

 {"roc_alloc":{"calls":27748110,"total_ns":1008667933},"roc_dealloc":{"calls":27747832,"total_ns":948177243},"roc_realloc":{"calls":0,"total_ns":0}}

 {"roc_alloc":{"calls":28169957,"total_ns":1023112203},"roc_dealloc":{"calls":28169676,"total_ns":961872158},"roc_realloc":{"calls":0,"total_ns":0}}

 {"roc_alloc":{"calls":28516927,"total_ns":1038033782},"roc_dealloc":{"calls":28516642,"total_ns":975673305},"roc_realloc":{"calls":0,"total_ns":0}}

view this post on Zulip Scott Campbell (Oct 30 2026 at 11:49):

Add grafana, chromium-devtools or something like that...

view this post on Zulip Anton (Oct 30 2026 at 12:23):

Interesting, I'm curious about all the ways people will use it :)


Last updated: Nov 04 2026 at 18:54 UTC