June 20th, 2024

The Pre-Scheme Restoration

The Pre-Scheme Restoration project, funded by NLnet foundation, aims to modernize the Pre-Scheme compiler, a subset of Scheme, for a new functional programming language. Led by Andrew Whatson, the project focuses on compatibility, tooling, and documentation.

Read original articleLink Icon
The Pre-Scheme Restoration

The Pre-Scheme Restoration project has commenced with funding from the NLnet foundation under the NGI Zero Core program. This initiative aims to revive the Pre-Scheme compiler, a subset of Scheme, to create a modern, statically-typed, low-level functional programming language. Pre-Scheme, developed by Richard Kelsey and Jonathan Rees, offers Scheme syntax with a static type system based on Hindley/Milner type reconstruction and an optimizing compiler targeting C for efficient native code generation. The restoration project seeks to enhance Pre-Scheme's compatibility with Scheme and C, improve tooling, and provide comprehensive documentation and examples for adoption. The roadmap includes porting the compiler to various Scheme implementations, extending language features, and developing a standard library. The project, led by Andrew Whatson, builds on previous efforts and aims to cater to the Scheme community's interest in systems-level development. Interested individuals can follow the project's progress through various channels and contribute to its success.

Related

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog is a compact interpreter written in C, compliant with ISO Prolog. It supports unbounded integers, UTF-8 atoms, efficient strings, and runs on Linux, Android, and WebAssembly. It offers C integration, SQLite access, concurrency features, and experimental functionalities. The project is open source under the MIT license.

As you learn Forth, it learns from you (1981)

As you learn Forth, it learns from you (1981)

The Forth programming language is highlighted for its unique features like extensibility, speed, and efficiency. Contrasted with Basic, Forth's threaded code system and data handling methods make it versatile.

Polytype: A Rosetta Stone for typesetting engines

Polytype: A Rosetta Stone for typesetting engines

Polytype is a project like Rosetta Code but for typesetting engines. It compares how different engines handle layout and orthographic features. Contributions are welcome via GitHub for new samples and improvements. Users can build examples locally and test the website.

Update on GNOME Newton, the Wayland-native accessibility project

Update on GNOME Newton, the Wayland-native accessibility project

The Newton project aims to enhance accessibility on free desktops, focusing on Wayland-protocols, AccessKit, Mutter, Orca, GTK, and libadwaita components. Progress includes running GTK 4 apps in Flatpak sandboxes, with ongoing work to improve Orca functionality on Wayland. Challenges involve optimizing performance and addressing architectural issues for assistive technologies. Future plans may extend support to GNOME Shell UI.

Gren 0.4: New Foundations

Gren 0.4: New Foundations

Gren 0.4 updates its functional language with enhanced core packages, a new compiler, revamped FileSystem API, improved functions, and a community shift to Discord. These updates aim to boost usability and community engagement.

Link Icon 16 comments
By @JonChesterfield - 4 months
Fantastic news! This is a really interesting place in the design space and has come so close to being lost to history.

I believe the idea is essentially to write C semantics in scheme notation. Variables get marked with 'u32' or similar instead of being implicit sum types of anything the language can represent, memory allocation is explicit instead of garbage collected. In itself that essentially means writing C syntax trees in prefix notation, which is probably an acquired taste.

However scheme also comes with the compile time macro layer and that lot runs just fine in pre-scheme, garbage collected and all, because it's burned off before runtime anyway. Specifically, it's wholly macro-expanded before compilation to C (or similar), which is the obvious lowering to use for execution.

Also scheme has tooling, so if you're careful, the type annotated Cish syntax trees execute correctly as scheme, so you can debug the thing there, unit test it from scheme and so forth.

I really like it as a path to writing lisp runtimes in something that isn't C since an alarming fraction of them turn out to have a C runtime library at the bottom of the stack. Also for writing other things that I tend to write in C, where it's really the semantics I want and the syntax getting in the way.

By @paroneayea - 4 months
Pre-Scheme is an incredible piece of history, largely forgotten and lost to time outside of a very small group that knew about it. Live hackable at the REPL, and yet with static type inference (Hindley-Milner!), compiles to C, no GC? It's something I've always wanted, and it existed, but it felt like one of those lost pieces of technology that was at risk of fading into the dustbin of history.

But no more! It's so exciting that Andrew Whatson has begun reviving the project with such great enthusiasm and making it so that Pre-Scheme can run on top of a variety of Schemes. And it's wonderful that NLnet has recognized how important this effort is. I think Pre-Scheme could play an interesting role alongside Zed and Rust, and indeed I know that Andrew plans to incorporate many of the newer ideas explored in those languages on top of Pre-Scheme eventually.

Go Pre-Scheme revival... I'm cheering it on, and can't wait to use this stuff myself!

By @voidhorse - 4 months
https://github.com/carp-lang/Carp is a recent attempt to create a similar language, but with a Rust-inspired borrow checker. though it looks like prescheme would end up being less dependent on C ultimately, this is another option in the space.
By @davexunit - 4 months
I am so excited for a Lispy systems language. Existing languages just don't do it for me, though I think Zig is the closest to being what I'm into. So much good stuff in Scheme48. Glad the good ideas are being revived.
By @giraffe_lady - 4 months
Scheme with HM type system sounds fun. I've used ocaml a fair bit and I really find that the sweet spot for effectiveness of types vs arguing with the compiler. Racket and common lisp both have optional type systems but neither ever really clicked with me.
By @dang - 4 months
Related:

Pre-scheme: A Scheme dialect for systems programming (1997) [pdf] - https://news.ycombinator.com/item?id=29725313 - Dec 2021 (12 comments)

(surprised there hasn't been more)

By @roleks - 4 months
few days I've spent a few hours with prescheme, but was stopped in the end because there where gcc errors. I've felt a little guilty to have have spent some quite some time, but not have achieved anything. But thats the thing with Prescheme, so fascinating I could not resist. I mean look at its history, at all the cool and unique features. Anyway, very cool to read this news, I'm also a little relieved not to have burnt all this hours into nothings. Very glad to see the story continues.
By @ethagnawl - 4 months
> On another front, the Guix project is a major force bringing new users to Scheme, providing an unparalleled foundation for free and reproducible computing.

The Nix/OS folks might take exception. I'm guessing this is tongue-in-cheek but it belies the tone of the rest of the post.

In all seriousness, though, this is exciting from a modern, end-user's vantage point and fascinating from an historical perspective.

By @troad - 4 months
This is very cool. I've added it to my RSS reader, can't wait to see what comes of it.

Genuine question: would there be any advantages in targeting LLVM IR, rather than transpiling to C? With C being notoriously implementation dependent (down to things like the sizes of integer types), it seems like a messy target for something intended to be a sane systems language.

By @trealira - 4 months
According to the article: thanks to a grant from the NLnet foundation under the NGI Zero Core program, Pre-Scheme can continue to be developed. It's supposed to be a C alternative. Currently, it compiles to C, has a Hindley Milner type system, macros, and it can run in a Scheme REPL. And they have a roadmap of features now.

This is pretty cool, and it's generous of them to grant them funding, but (and I'm not trying to be rude) I wonder why they chose to give a grant for Pre-Scheme specifically. This seems only loosely related to the goals of the NGI Zero Core program (linked in the article):

"The next generation internet initiative envisions the information age will be an era that brings out the best in all of us. We want to enable human potential, mobility and creativity at the largest possible scale – while dealing responsibly with our natural resources. In order to preserve and expand the European way of life, the programme helps shape a value-centric, human and inclusive Internet for all."

...

"We want a more resilient, trustworthy and open internet. We want to empower end-users. Given the speed at which the 'twin transition' is taking place, we need a greener internet and more sustainable services sooner rather than later. Neither will happen at global scale without protocol evolution, which — as the case of three decades of IPv6 introduction demonstrates — is extremely challenging. NGI0 Core is designed to push beyond the status quo and create a virtuous cycle of innovation through free and open source software, libre hardware and open standards. If we want everyone to use and benefit from the internet to its full potential without holding back, the internet must be built on strong and transparent technologies that allow for permissionless innovation and are equally accessible to all."

By @Y_Y - 4 months
NLNet is doing god's work funding really cool projects that would have a very hard time justifying their existence to some mainstream donors.

I dream of some day soon running Emacs/Guix/Hurd on an open RISC-V chip and not having it be some flossy novelty but a genuine spiritual successor to Genera and the Lisp Machines.

By @a2code - 4 months
Tail-call optimization is very important when writing Scheme programs. By removing those, you loose the power of recursion.

Also when it comes to macros, does that include `syntax-rules` or `syntax-case` style macros, where the latter are much more powerful?

While an embedded Scheme-like language is incredibly useful, at some point I feel as if you would simply have to include these features, and to that end it would just be Scheme reinvented.

By @dg_meme - 4 months
Please don't write "thanks to a generous grant from the NLnet foundation under the NGI Zero Core program". The most of money comes from the European Commission through the Horizon Europe / NGI funding schemes. NLNet is mainly the operator of the call.
By @tmtvl - 4 months
See also (kinda, maybe) c-mera: https://github.com/kiselgra/c-mera
By @hayley-patton - 4 months
The hell of the systems language is the systems, not that it has infix syntax.
By @pjc50 - 4 months
A Hindley-Milner typed language with rigorous semantics for targeting native platforms? Amazing! Pity about the syntax.