[HN Gopher] The Pre-Scheme Restoration
       ___________________________________________________________________
        
       The Pre-Scheme Restoration
        
       Author : nickmain
       Score  : 50 points
       Date   : 2024-06-20 11:40 UTC (2 days ago)
        
 (HTM) web link (prescheme.org)
 (TXT) w3m dump (prescheme.org)
        
       | trealira wrote:
       | 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."
        
         | paroneayea wrote:
         | Pre-Scheme is one more path to moving away from low level
         | programming being done on top of directly programmed C for one
         | thing, and the revival effort directly ties in by moving Pre-
         | Scheme to be on top of r7rs, an open standard. This opens up
         | Pre-Scheme to a variety of other ecosystems that NLnet already
         | invests in, including Guix, Mes, and Guile, which have put a
         | lot of efforts into secure and highly reproducible (and indeed
         | bootstrappable) computing. There's definitely some ties in with
         | security and security-oriented communities NLnet already funds,
         | and this project directly works towards moving towards a more
         | standardized approach, leading to hopefully broader adoption.
        
           | trealira wrote:
           | I see, thanks for contextualizing it for me; I hadn't known
           | about the ecosystems NLnet is involved in.
        
       | paroneayea wrote:
       | 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!
        
       | davexunit wrote:
       | 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.
        
         | dualogy wrote:
         | > I am so excited for a Lispy systems language.
         | 
         | Can recommend Gerbil Scheme. Although fair warning, still GC'd
         | and (for now) only type-annotated, not (100%) statically typed.
         | But stdlib-wise and compilation-wise still way more "systems-
         | bent" than most Schemes out there.
        
           | dang wrote:
           | Related:
           | 
           |  _Gerbil Scheme - A Lisp for the 21st Century_ -
           | https://news.ycombinator.com/item?id=39809323 - March 2024
           | (126 comments)
           | 
           |  _Gerbil - A meta-dialect of Scheme_ -
           | https://news.ycombinator.com/item?id=20585637 - Aug 2019 (17
           | comments)
           | 
           |  _Gerbil Scheme_ -
           | https://news.ycombinator.com/item?id=17707622 - Aug 2018 (9
           | comments)
           | 
           |  _Gerbil - An opinionated dialect of Scheme designed for
           | systems programming_ -
           | https://news.ycombinator.com/item?id=15394603 - Oct 2017 (78
           | comments)
        
       | Y_Y wrote:
       | 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.
        
       | JonChesterfield wrote:
       | 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.
        
       | dg_meme wrote:
       | 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.
        
         | paroneayea wrote:
         | The European Commission deserves thanks for funding the
         | commons, a thing that rarely happens by governments, but
         | should! NGI Zero was thanked though?
         | 
         | NLnet being the operator of the call is no small thing though,
         | having been through the process they are very thoughtful,
         | knowledgeable, thorough in how they run things. They even run
         | the software they fund and verify it's working and check that
         | the overall ideas are sensible, which is something I can't say
         | of many other grant programs I've interacted with. So NLnet
         | does deserve thanks.
        
       | giraffe_lady wrote:
       | 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.
        
         | Y_Y wrote:
         | Have you tried Alexis King's Hackett? It was an experiment in
         | coercing Haskell semantics into lisp syntax and it came out
         | really nicely.
         | 
         | https://lexi-lambda.github.io/hackett/
        
           | giraffe_lady wrote:
           | Totally new to me, thanks! It looks really fun.
        
       | pjc50 wrote:
       | A Hindley-Milner typed language with rigorous semantics for
       | targeting native platforms? Amazing! Pity about the syntax.
        
       | hayley-patton wrote:
       | The hell of the systems language is the systems, not that it has
       | infix syntax.
        
         | Zambyte wrote:
         | Depends on if your "systems programming" activities consist of
         | compiling Scheme or not.
        
       | ethagnawl wrote:
       | > 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.
        
         | ryukafalz wrote:
         | It doesn't read as tongue-in-cheek to me. NixOS does not have
         | an equivalent to Guix's full-source bootstrap mentioned in the
         | next sentence: https://guix.gnu.org/blog/2023/the-full-source-
         | bootstrap-bui...
         | 
         | Nixpkgs also doesn't seem to require that all packages be built
         | from source - which, if you're really looking for
         | reproducibility, is a downside. I recognize that there are
         | practical reasons for this, and it's part of why Nix has so
         | many more packages available than Guix, but IMO it makes Guix a
         | better foundation to build on if you want as much of your
         | system as possible to be reproducible.
        
           | Y_Y wrote:
           | There is also the "secret" nonguix channel which packages
           | nonfree things for Guix: https://gitlab.com/nonguix/nonguix
           | 
           | It's a funny problem but because it's antithetical to the
           | original project's spirit you won't hear about it from any
           | official Guix sources and so it's relatively unknown.
        
             | ryukafalz wrote:
             | I wouldn't say it's relatively unknown, I see it come up
             | just about every time Guix comes up in discussions here.
             | And I'm glad nonguix exists, for what it's worth.
             | 
             | But it's helpful to have Guix itself aim for
             | reproducibility even if nonguix exists, so you can install
             | upstream Guix alone if you're looking for reproducibility.
        
           | rssoconnor wrote:
           | > Nixpkgs also doesn't seem to require that all packages be
           | built from source - which, if you're really looking for
           | reproducibility, is a downside.
           | 
           | Does Guix not have GHC (Glasgow Haskell Compiler) or did it
           | somehow bootstrap GHC? Last time I checked bootstrapping GHC
           | on today's hardware is effectively an unsolved problem. [1]
           | 
           | > NixOS does not have an equivalent to Guix's full-source
           | bootstrap
           | 
           | While you are not wrong, there is nothing fundamentally
           | stopping Nixpkgs from being bootstrapped in a similar way to
           | Guix. emilytrau has already done a lot of the work. [2]
           | 
           | [1] https://elephly.net/posts/2017-01-09-bootstrapping-
           | haskell-p... [2] https://github.com/NixOS/nixpkgs/pull/227914
        
             | ryukafalz wrote:
             | > Does Guix not have GHC (Glasgow Haskell Compiler) or did
             | it somehow bootstrap GHC? Last time I checked bootstrapping
             | GHC on today's hardware is effectively an unsolved problem.
             | 
             | I think you're right, it looks like they've gotten a little
             | further now than in that post but there's still a gap in
             | the bootstrap chain. So maybe not every package is fully
             | bootstrapped, but they do seem to take it more seriously.
             | 
             | > While you are not wrong, there is nothing fundamentally
             | stopping Nixpkgs from being bootstrapped in a similar way
             | to Guix. emilytrau has already done a lot of the work.
             | 
             | Yes, I agree, and I hope they get there! I just also think
             | that acknowledging the places where Guix is currently ahead
             | isn't wrong. Nix isn't the only game in town anymore.
        
               | rssoconnor wrote:
               | > it looks like they've gotten a little further now than
               | in that post
               | 
               | Can you say more, or provide any references? I would be
               | interested in the state of the art here.
        
               | ryukafalz wrote:
               | There's a comment in the Guix source (added by the author
               | of that first post you linked, Ricardo Wurmus) that seems
               | to indicate that they found a way around the segfault
               | problem described in the post by using a registerised
               | version of GHC: https://git.savannah.gnu.org/cgit/guix.gi
               | t/tree/gnu/packages...
               | 
               | I had to look up exactly what this means, not being very
               | familiar with the Haskell ecosystem myself. It looks like
               | it's not the raw source form and is architecture-
               | specific, but it's also not the compiled binary form. So
               | that's not perfect, but better than relying on the
               | compiled binaries I guess. (Unfortunate for me since my
               | laptop is ARM and I'd like to be able to use git-annex,
               | haha.) But this seems to work for older versions of GHC.
               | 
               | This post by Simon Tournier from last year describes the
               | current situation near the bottom, and from what I can
               | tell this is still correct: https://simon.tournier.info/p
               | osts/2023-10-01-bootstrapping.h...
               | 
               | > The bootstrapping problem for Haskell is not solved.
               | And Ricardo works hard on it. Currently, from the older
               | GHC around (4.08.2), which relies on gcc-2.95 - part of
               | the Bootstrapping story above - it is possible to chain
               | until version 6.10.4. Then versions 6.12.3 and 7.4.2 are
               | not packaged yet for completing the Haskell chain from
               | version 4.08.2 to modern version as 9.2.5; fully
               | connecting the dots with bootstrap-seeds and dropping
               | these 450MiB of binaries. The solution of this chicken-
               | or-the-egg is not yet complete.
        
           | 3836293648 wrote:
           | Nix doesn't require everything to be built from source, sure,
           | but everything downloaded must match a provided hash. What's
           | the difference between downloading source code and binaries
           | at that point?
        
             | ryukafalz wrote:
             | It's easier to audit source code than binaries, and easier
             | to audit it once than once for each architecture.
        
       | voidhorse wrote:
       | 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.
        
         | dualogy wrote:
         | Stumbled upon this a while ago while looking for "a systems
         | Scheme", but abandonware in my book given the most recent
         | commit date (and GH Issue).
         | 
         | Settled on Gerbil Scheme instead, lively community & been
         | actively developed to this day for over 15 years now. Although
         | fair warning, still GC'd and (for now) only type-annotated, not
         | (100%) statically typed. But stdlib-wise and compilation-wise
         | still way more "systems-bent" than most Schemes out there.
        
           | davexunit wrote:
           | Guile is quite systems focused, as well, what with all the
           | POSIX stuff it exposes. But neither Guile nor Gerbil can be
           | used to implement their own runtimes. You need to write the
           | GC, somehow. This is why Pre-Scheme exists.
        
       | roleks wrote:
       | 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.
        
       | dang wrote:
       | 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)
        
       ___________________________________________________________________
       (page generated 2024-06-22 23:00 UTC)