Skip to content

Instantly share code, notes, and snippets.

@plexus
Created September 15, 2023 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plexus/bc242704ef450242360cddd07a0d09cf to your computer and use it in GitHub Desktop.
Save plexus/bc242704ef450242360cddd07a0d09cf to your computer and use it in GitHub Desktop.

Today we are happy and proud to announe the first public release of Piglet, a new programming language and dynamic runtime in the Lisp tradition, for the web age.

Piglet itself is written in JavaScript and Piglet. It can run in any modern JavaScript runtime, be it inside or out of the browser. We've been working hard on Piglet for the past six months, and are happy with how far it's come already.

That said we've been hesitant to make a public announcement. We have a big vision for Piglet, and bringing that vision into being is going to take time. We don't want people to dismiss the project entirely because what we have to show today is not yet complete or living up to expectations.

But at some point we have to come out with it, so we've decided to start showing what we have to the world. We'll talk in this post about what is there and how you can get your hands on it and try it out. If you're a nerd who loves to play around with newly emerging tech then jump down to the bottom for instructions on how to get started.

The Vision

There are a few things we need to talk about here: One-stop Shop, Connected Programming, Standards-based, Casual Programming.

One-stop Shop

Before you can start using a programming language, you need to figure out the tooling and navigate the ecosystem. This can be bewildering. Many languages don't provide built-in tooling for even fairly basic tasks like package management, leaving it to the community to fill this gap. The result is often multiple competing offerings, outdated and conflicting advice, and a lot of pain.

Piglet aims to have everything you need to get started under the Piglet project umbrella. The language itself, with a comprehensive standard library, editor integrations, project and packaging tooling, a dev server for web dev, a test runner, etc.

This way there's a clear, official, well supported path, and we can ensure a unified and smooth experience across the board. People who are interested in improving the experience are encouraged to do so within the Piglet project. Initially a lot of these things will be missing, or just minimal placeholders, which act as an open invitation to collaborators.

Connected Programming

Disconnected programming has become the dominant paradigm. It's so common that people don't even notice that that's what they are doing.

In a typical setup people type in their editor, which does its own parsing and analysis for things like syntax highlighting, and then there's an LSP server process, which does its own parsing and static analysis, and then there's a compiler, which does it again, and then the program runs somewhere "over there". Maybe there's an extra process that offers a REPL for experimentation, and an ephemeral process to run tests. There's all these disconneceted pieces without a shared understanding of the world.

A lot of struggles with "tooling" stem from this cardinal sin. We have cobbled together a development environment out of disconnected pieces, which need to somehow agree on the state of the world based on what each sees on the filesystem. Plato would make a fine allegory out of it all.

The history of LISP and Smalltalk show us what an alternative can look like. A dynamic runtime that contains a live compiler in the same process as the running program. That can be queried and inspected, and that can load, and evaluate new code on the fly. It can make facilities available for your editor (or even embed an editor directly within the same runtime), or provide debugging tools, all from a single unified process.

The most immediately apparent benefit is the rapid feedback loop provided by interactive development (sometimes called REPL-driven development). We think we can provide a development experience that is beyond the imagination of most contemporary programmers.

Standards-based

Piglet itself needs nothing but a standard EcmaScript runtime, and a converter from ESTree (a standardized EcmaScript AST) to code. By being free of dependencies, and only relying on standards with multiple implementations gives us a stable foundation, and should ensure the longevity of the project.

The language itself also sports excellent support for (web) standards, and we aim to have a standard library that provides all you need to develop within a web context.

Piglet encourages the use of RDF style identifiers (IRIs), and has support on the language and syntax level to make working with fully qualified identifiers as seemless as using simple keywords. We want to encourage people to think about the shape of their data in a global context, to adopt existing vocabularies or publish their own, so that information becomes self-describing, and can continue to exist beyond its original context.

Casual Programming

Not everyone who learns to read wants to become a professional writer. Similarly coding and algorithmic thinking should be a basic skill that people can use in their everyday life. We call this casual programming. Code that isn't written "on the clock" or is meant to "go into production".

Computers were once touted as a "bicycle for the mind", but these days they mainly serve as efficient consumption devices. We watch movies, consume social media, use slick web apps by VC backed startups. We have disconnected apps, each a tiny data silo. Computers used to come with a programming environment built in, sometimes it was the only thing the computer came with.

We want to make the power of computing more generally accessible again. There are a lot of languages that cater for professionals only. People who have the time and the experience to jump through tooling hoops and navigate an ecosystem.

The language

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment