{"id":19439200,"url":"https://github.com/spacejam/seaslug","last_synced_at":"2025-07-18T20:34:12.993Z","repository":{"id":50726394,"uuid":"347385501","full_name":"spacejam/seaslug","owner":"spacejam","description":"scraps of a potential language","archived":false,"fork":false,"pushed_at":"2021-04-09T19:33:10.000Z","size":631,"stargazers_count":37,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-19T05:57:51.980Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spacejam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-13T13:59:58.000Z","updated_at":"2024-10-09T07:54:01.000Z","dependencies_parsed_at":"2022-09-26T21:31:19.805Z","dependency_job_id":null,"html_url":"https://github.com/spacejam/seaslug","commit_stats":null,"previous_names":["spacejam/puke"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fseaslug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fseaslug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fseaslug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fseaslug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacejam","download_url":"https://codeload.github.com/spacejam/seaslug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250719795,"owners_count":21476136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T15:21:50.334Z","updated_at":"2025-04-24T22:32:27.018Z","avatar_url":"https://github.com/spacejam.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"before reading further, it is recommended that you [understand how awesome sea slugs are](https://www.google.com/search?q=sea%20slug\u0026tbm=isch).\n\n# seaslug\n\nA terse interpreted functional linear typed actor language for building low-defect performant stateful distributed systems.\n\n```\nmodule(my_http3_counter).\nbehavior(h3).\n\nstate(counter: u64).\n\n# expected handler cases for http 3.0\non(state, data, connection, stream_id, body) -\u003e\n  state.counter += 1,\n  h3.respond(state.counter),\n  state;\non(state, _, _, _, _) -\u003e\n  state.\n```\n\n##### some additional buzzwords for your enjoyment\n\ncontracts, actors, software transactional memory, io_uring, interpreters and futamura projections, structure-aware fuzzing, reduced order model checking, discrete event simulation.\n\nread and write less code. test and specify more code.\n\nvery much in the pre-prototype research stage.\n\n##### seaslug does not aim to excel at\n\n* building your own data structures (write this in Rust and use + test it from seaslug)\n* intensive numerical processing (write this in Rust and use + test it from seaslug)\n\n##### motivation\n\nI hope to create systems that can be forgotten in the way that an\nif-conditional can be forgotten, or the way that SQLite can be forgotten. When\nthings match our expectations, we do not need to burden our active minds with\ntheir complexity. I hope to be part of communities that are not fixated on the\nproblems of a programming language itself, but by the fascinating complexity of\nreality which the programmer is enabled by a language to be at play with.\n\nEngineers (myself included) are constantly running into the same traps over and\nover again. A huge number of problems boil down to the simple fact that we\nwrite a lot of code that is never actually executed while we are developing it.\n\nI've talked about this [again](https://sled.rs/simulation) and\n[again](https://sled.rs/errors), but there are two particularly interesting\nexcerpts from the paper [Simple Testing Can Prevent Most Critical Failures: An\nAnalysis of Production Failures in Distributed Data-intensive\nSystems](http://www.eecg.toronto.edu/~yuan/papers/failure_analysis_osdi14.pdf)\nthat I feel a language should assist a programmer in addressing:\n\n```\nalmost all (92%) of the catastrophic system failures\nare the result of incorrect handling of non-fatal errors\nexplicitly signaled in software.\n```\n\nThat is, we tend to write error handling code that is broken.\n\n```\nin 58% of the catastrophic failures, the underlying\nfaults could easily have been detected through simple\ntesting of error handling code.\n```\n\nThat is, if the error handling code had been tested in even a rudimentary way,\nthe problems that caused the system failure would likely have been detected.\n\nMost of our problems are the kinds of problems that require some sort of fault\ninjection if we want to find them before reality fault injects them without our\nconsent while they are running in production. While it is possible in many\ncases to avoid a growing body of defects through interesting type systems, the\neffort required to thoroughly specify correctness properties of many systems is\nmade more difficult by the challenging process required to determine what the\ncorrect specification of the program actually is.\n\nI would like to have a language that is lightweight to initially write, but\nthat allows rich specifications to be incorporated over time as the programmer\nlearns through the built-in model checking functionality to bolt things down\nmore and more through an interactive process.\n\n##### influences\n\n* [Erlang](https://erlang.org/doc/) is among the most elegant programming\n  languages for building reliable distributed systems in popular use today. [It\n  has a variety of features](https://ferd.ca/the-zen-of-erlang.html) that\n  strongly contribute to a feeling of lightness while writing programs. Over\n  time, the Erlang community has engineered some incredibly powerful testing\n  tools such as [PULSE](http://quviq.com/documentation/pulse/index.html),\n  [Conquerror](https://github.com/parapluu/Concuerror),\n  [CutEr](https://github.com/cuter-testing/cuter), and several high-quality\n  property testing frameworks that have seen tremendous success in creating\n  robust distributed systems.\n* [Ada SPARK](https://docs.adacore.com/spark2014-docs/html/ug/en/spark_2014.html)\n  combines a built-in verification toolchain with rich contract specification\n  capabilities and the ability to disable various language features that tend to\n  increase the costs of verification. Ada and SPARK have seen great success in the\n  safety-critical domain due to several features that ultimately make the\n  software understandable by humans and the tools we have available for\n  assisting us in the understanding process.\n* [The P language](https://github.com/p-org/P) is a language with first-class\n  state-machine support, which in many ways feels like what would happen if\n  TLA+ were to become an actual programming language.\n* [The Dafny language](https://github.com/dafny-lang/dafny) is a language\n  that leans into [the amazing capabilities of\n  z3](https://www.microsoft.com/en-us/research/video/the-varied-forms-of-verification-with-z3/)\n  to prove [a powerful set of constraints at\n  compile-time](https://dafny-lang.github.io/dafny/QuickReference).\n* [The Bologna Optimal Higher-order Machine (BOHM)](https://github.com/asperti/BOHM1.1)\n  The BOHM is an implementation of a lazy term reduction strategy sketched out\n  in the book \"The Optimal Implementation of Functional Programming Languages\"\n  by Andrea Asperti and Stefano Guerrini that discusses interesting\n  applications of linear logic to computation.\n* [Celf](https://www.cs.cmu.edu/~cmartens/lpnmr13.pdf)'s nondeterminism and\n  interesting applications of linear logic.\n* [Constraint Handling Rules](https://en.wikipedia.org/wiki/Constraint_Handling_Rules)'s verification opportunities\n* Prolog's declarative debugging, tables, proof capabilities\n* Total Functional Programming's restrictions on recursion and looping\n* [ivy](https://github.com/microsoft/ivy/blob/master/examples/raft/raft_logs.ivy)\n\n##### prospective features\n\nThis project is still very much in the prospective research phase where I'm trying\nto understand which of these features may not compose well with the others. That\nsaid, here are some of the bits of functionality that I am interested in:\n\n* erlang's terseness, behaviors, focus on immutable message passing, explicit\n  supervisor hierarchies, pattern matching, binary parsing capabilities\n* built-in fault injection, fuzzing, model checking (with built-in linearizability-aware history validator),\n  network simulation, concurrent interleaving exploration, ALICE-like filesystem action verification\n* typed actors running pure state transformation functions using inputs provided by a high performance IO engine\n* immutable messaging for unidirectional communication\n* optimistic STM for modifying shared state in a safe way\n* escape hatch: easy calling of Rust functions similar to Erlang NIFs and ports\n* the ability to reason about termination (in some contexts), value ranges or other invariants at compile-time inspired by Dafny\n* a runtime built from the beginning to take advantage of io_uring/IOCP, and generally paying attention to modern scheduling research\n  * the runtime tracks system resource utilization and saturation\n  * the default server behavior aims to maximize utilization while minimizing saturation,\n    prioritizing writes before reads before accepts for sockets\n    to keep in-flight work at an appropriate level for avoiding adverse saturation.\n  * infers contention causality encountered in the optimistic state layer and learns to step in as\n    a traffic director when a pessimistic approach becomes necessary to avoid\n    contention and wasted effort that leads to system saturation, letting users\n    avoid thinking about contention.\n* leans into linear logic to enforce error handling in well-specified hierarchies, similar to Erlang supervisors\n* interpreter-first, but the interpreter itself aims to compile quickly so you can produce static optimized native binaries (something something Futamura something...)\n* built-in first-class fault injection, fuzzing, network simulation, model-based testing, and concurrent interleaving exploration\n* rich built-in data structures, first-class json support, first-class binary parsing support\n\n##### seaslug is written in Rust and takes advantage of things like\n\n* io_uring\n* simdjson\n* sled\n* software transactional memory\n* http3\n\n##### resources I'm studying while experimenting with this\n\n* Frank Pfenning's lectures on [Bug Catching (CMU Spring 2021)](http://www.cs.cmu.edu/~15414/schedule.html) and [Linear Logic (CMU Spring 2012)](https://www.cs.cmu.edu/~fp/courses/15816-s12/schedule.html)\n* Robert Harper's Practical Foundations for Programming Languages, 2nd ed\n* Handbook of Model Checking - Edmund M. Clarke et al.\n* Logic for Concurrency and Synchronisation - Ruy J.G.B. de Queiroz\n* Programming Distributed Computing Systems - Carlos Varela\n* Program = Proof - Samuel Mimram\n* The Optimal Implementation of Functional Programming Languages - Andrea Asperti and Stefano Guerrini\n* [A Fast Linear-Arithmetic Solver for DPLL(T)](http://leodemoura.github.io/files/cav06.pdf)\n* [Compiling Pattern Matching to Good Decision Trees](http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Fseaslug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacejam%2Fseaslug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Fseaslug/lists"}