[HN Gopher] Racket branch of Chez Scheme merging with mainline C...
       ___________________________________________________________________
        
       Racket branch of Chez Scheme merging with mainline Chez Scheme
        
       Author : Decabytes
       Score  : 208 points
       Date   : 2023-11-06 03:35 UTC (17 hours ago)
        
 (HTM) web link (groups.google.com)
 (TXT) w3m dump (groups.google.com)
        
       | ashton314 wrote:
       | Very exciting stuff! I submitted a link to the actual MR when
       | this happened; wasn't discussed much at the time:
       | https://news.ycombinator.com/item?id=37932016
       | 
       | (This current submission is really nice; you get to hear more
       | from Matthew about what's going on.)
       | 
       | Chez Scheme (pronounced "shay-scheme") is the most performant and
       | compliant Scheme implementation out there. [1] For a long time it
       | was closed-source, but was recently open-sourced.
       | 
       | It now forms the foundation of the Racket language. (So, I guess
       | that means HN relies on it, provided Arc is using a recent
       | version of Racket.) I asked Matthew why he picked Chez to base
       | Racket off of, and I want to say that he picked it because it
       | implemented continuations really really well and had a good
       | garbage collector too. I could be wrong.
       | 
       | [1]: https://ecraven.github.io/r7rs-benchmarks/
        
         | ReleaseCandidat wrote:
         | Idris has changed from compiling to C to Chez (or Racket) with
         | Version 2 https://youtu.be/h9YAOaBWuIk?si=gkm2d_KLa3d9eoy5
        
       | neilv wrote:
       | It's encouraging to see all this solid (if unglamorous) software
       | engineering work happening, for a powerful platform that also has
       | active research going on.
       | 
       | (Maybe I'll find a way to resume using Scheme/Racket. The last
       | few years, I've been using Python, JS, and Rust, partly for
       | employability reasons. They have their merits, but I'm aware of
       | what I'm missing.)
        
       | ltac wrote:
       | Is it a good idea to use Chez Scheme to go over SICP? Meaning, is
       | it still standard to enter into compatibility mode to do so?
       | Thanks.
        
         | kkylin wrote:
         | It's been a long time since I went through SICP, so someone
         | with more recent knowledge should correct me. But I think you
         | can get through most (almost all?) of SICP with what's in the
         | Scheme standard, which is a pretty small subset of almost any
         | Scheme implementation. In particular, I don't recall much that
         | uses anything specific to MIT Scheme.
        
         | neilv wrote:
         | We made Racket support for SICP, which is the next best thing
         | to using MIT Scheme for SICP:
         | 
         | https://docs.racket-lang.org/sicp-manual/
         | 
         | (SICP Scheme isn't quite standard, and there's also some SICP-
         | specific libraries.)
        
       | aragonite wrote:
       | I'll always have a soft spot for Racket, because of how the IDE
       | literally _draws arrows_ for you, overlaid on top of the code,
       | linking the various occurrences of a (hovered) variable
       | together.[1][2] Seriously, how cool is that? Alas, it 's unclear
       | how to begin to implement such a feature in a performant way in a
       | DOM-based editor like vscode (I'm not a web developer, so maybe
       | I'm wrong about this.)
       | 
       | [1] Example gif: https://docs.racket-lang.org/define-
       | attributes/examplecodear...
       | 
       | [2] > Lexical Structure: The lexical structure is shown with
       | arrows overlaid on the program text. When the mouse cursor passes
       | over a variable, DrRacket draws an arrow from the binding
       | location to the variable, or from the binding location to every
       | bound occurrence of the variable.
        
         | ReleaseCandidat wrote:
         | I don't think you can do that in a "normal" VS Code editor
         | window, but it is possible in a custom one (where you have to
         | do "everything" yourself):
         | https://code.visualstudio.com/api/extension-guides/custom-ed...
         | 
         | (so, not much chance of adding that to my Chez extension ;)
        
         | pjmlp wrote:
         | The coolness of Lisp Machines and Interlisp-D, which is where
         | Raket took its inspiration from.
        
           | sitkack wrote:
           | The Racket community is just full of wholesome folks and it
           | is contagious. Racket makes more awesomeness in the world.
        
             | jboynyc wrote:
             | Yes, there are many lovely people, but it is best not to
             | romanticize the community as a whole -- it's got some
             | issues, too: https://beautifulracket.com/appendix/why-i-no-
             | longer-contrib...
        
           | mark_l_watson wrote:
           | I agree. In 1982 I got a Lisp Machine running InterLisp-D,
           | and it was "batteries included" like Racket.
           | 
           | If you don't mind Smalltalk, the modern Pharo ecosystem is
           | also amazing.
        
           | lispm wrote:
           | Neither of those restarted their Lisp when one pressed a run
           | button. The Lispm IDEs were always running and always in the
           | same environment as the programs. A whole different story.
        
         | tkzed49 wrote:
         | No idea how to do this in a VSCode extension, but you could
         | place a full-screen <canvas> over the whole editor with
         | pointer-events: none. Then, you could use offsetLeft/Top or
         | getBoundingClientRect() on relevant text elements to figure out
         | where to draw lines on the canvas.
        
         | Galanwe wrote:
         | Did not try Racket specifically, but I did quite a lot of work
         | with Dr. Scheme 15/20 years ago, which I think is Racket's
         | ancestor?
         | 
         | It would allow you to define variables which were actual
         | images. The image was a thumbnail in the code, which you could
         | assign and print. It was mind blowing.
         | 
         | Also your Lambda keywords could be replaced with an actual
         | Lambda symbol, which was the pinnacle of coolness.
         | 
         | This, as well as the super snappy and responsive split REPL,
         | made the overall development experience with Scheme feel super
         | futuristic and just a pure enjoyment all around.
        
           | Y_Y wrote:
           | It's got myriad other issues, but Mathematica is a lot like
           | this. You can have "rich" literals like a sound file or and
           | image or a 3d model and see and manipulate along with the
           | source, which has a couple of different levels of syntactic
           | sugar, from being an ugly text-only lisp up to stuff that
           | looks like it comes from a well-illustrated text book.
           | 
           | What's missing from my life is a good FOSS equivalent. There
           | are several wonderful tools which do similar things, e.g.
           | Jupyter, org-babel, TeXmacs, Sage, mathics. None of them feel
           | quite right though.
        
             | mark_l_watson wrote:
             | I once had fantasies about starting an open source project
             | for Common Lisp that would attempt to implement a little
             | bit of the Wolfram data display stuff. I stopped paying for
             | LispWorks, so I no longer have CAPI for GUIs, so that is
             | not going to happen. Racket's UI support would make Racket
             | a good platform for an open source project like this. (I
             | won't work on it, LLMs are so much more fascinating than
             | any other tech, and use up my free time).
             | 
             | I did recently pay for an entire year of Wolfram Desktop in
             | the hope of really getting into it. I have code experiments
             | for all the stuff I love (machine learning, deep learning,
             | LLM, semantic web, etc.) but to be honest using the Wolfram
             | Language does not give me the joy that I get using Common
             | Lisp,and various Schemes, and, for some things Python is
             | the most practical language.
        
             | bitwize wrote:
             | HolyC is like this as well.
        
           | spdegabrielle wrote:
           | It has changed quite a bit in 20 years
        
         | BaculumMeumEst wrote:
         | racket is also one of the very few free lisps with a visual
         | debugger and stepper, which is crazy when you realize how
         | widely available that is in modern languages
        
           | pjmlp wrote:
           | Most likely because they got students to implement that for
           | their thesis work, and free Common Lisp are seldom used for
           | thesis stuff.
           | 
           | Like in many free tooling most people rather do with what
           | they have instead of improving them, hence why all great
           | developer experiences are either commercial or corporate
           | sponsored.
        
             | mbork_pl wrote:
             | > all great developer experiences are either commercial or
             | corporate sponsored
             | 
             | GNU Emacs disagrees.
        
               | pjmlp wrote:
               | VSCode adoption in detriment of Emacs disagrees.
        
               | mbork_pl wrote:
               | GP talked about "great developer experiences", not
               | adoption. There are lots of reasons inferior tools,
               | standards etc. may be more widely adopted.
        
               | pjmlp wrote:
               | Great development experiences drive adoption.
               | 
               | I know Eight Megabytes of Continuous Memory Swap since
               | those 8MB actually mattered.
        
               | dTal wrote:
               | "EMoCMS"?
               | 
               | It's "Eight Megabytes And Constantly Swapping".
        
               | pjmlp wrote:
               | Yeah, it's been a while.
        
         | spdegabrielle wrote:
         | I don't think the arrows are possible with VScode?
         | 
         | Someone said they might be possible with CodeMirror
         | https://codemirror.net/
         | 
         | (Just in general - not specifically for racket- I'd love to see
         | this for rust and elixir)
        
           | ReleaseCandidat wrote:
           | > I don't think the arrows are possible with VScode?
           | 
           | They are possible, but not using the "normal" editor window,
           | you need a "custom" one:
           | https://code.visualstudio.com/api/extension-guides/custom-
           | ed...
        
             | spdegabrielle wrote:
             | So not completely impossible, just effectively impossible.
        
               | cfiggers wrote:
               | Why would doing it in VS Code be any more or less
               | impossible than implementing it from scratch anywhere
               | else?
        
         | mark_l_watson wrote:
         | I have also have a soft spot for Racket, although
         | professionally I lean on Common Lisp to get stuff done.
         | 
         | The once a year RacketCon conference was two weekends ago, and
         | in addition to the technical talks, I enjoyed hearing the 4
         | academics who are primary implementers and maintainers taking
         | questions from the audience about why Racket is not targeted at
         | industry. I am just finishing up writing a Racket book, that
         | really just consists of my own little code experiments (no big
         | deal). You can read it free online https://leanpub.com/racket-
         | ai/read
        
           | bmitc wrote:
           | > I enjoyed hearing the 4 academics who are primary
           | implementers and maintainers taking questions from the
           | audience about why Racket is not targeted at industry.
           | 
           | That's interesting. That seems like a flip from a few years
           | ago. What was the summary regarding this?
        
             | mark_l_watson wrote:
             | My understanding of what the 4 academic devs were saying:
             | Racket is a rich environment for language experiments,
             | academic work, and is attracting some interest in wider
             | commercial use. I think they hope that more 3rd parties do
             | some of the work for supporting industrial applications. I
             | didn't take notes of the panel discussion, but this is how
             | I remember the dialog.
        
               | soegaard wrote:
               | The question came from a young member of the audience. It
               | was phrased something like:
               | 
               | "Why isn't Racket used in industry like OCaml is used by
               | Jane Street."
               | 
               | And what can you answer to that? Of course the Racket
               | would like for some both commercial users as well as
               | sponsors.
               | 
               | In fact [1] Racket changed its license from LGPL to
               | Apache 2.0 or the MIT license to make sure it can be used
               | commercially.
               | 
               | The fact is that language popularity isn't determined by
               | quality of language/implementation alone. Having
               | companies like Apple (Swift) and Google (Go) backing a
               | language helps tremendously.
               | 
               | [1] https://blog.racket-lang.org/2019/11/completing-
               | racket-s-rel...
        
           | samth wrote:
           | I don't have notes of what I said (recording will be up soon)
           | but that isn't what I was trying to say at all. We value use
           | in industry and have made significant effort to enable it
           | (like relicensing everything). It is true, of course, that
           | we're academics, and so we need to learn from others about
           | how to better enable industrial use of Racket, but that is
           | not because we don't care about it.
        
             | davidrupp wrote:
             | I didn't read "not targeted at industry" as equivalent to
             | "doesn't care about industry".
        
               | velcrovan wrote:
               | Indeed. Racket maintainers do consider input from
               | industry users and sometimes make changes based on that
               | input, but it is not targeted at industry.
        
             | mark_l_watson wrote:
             | I enjoyed the panel discussion - I was not complaining.
        
       | sillysaurusx wrote:
       | Apropos nothing, can we get SICP added to SCP? I've always
       | thought it would be a fantastic entry. "Artifact SCP-31415, code
       | name SICP, is a book on an obscure programming language. Students
       | have been observed to die of fright when confronted with it, and
       | those that escape have visible scars from what appear to be tiny
       | blade-like curved objects. Some, however, end up becoming
       | superstar programmers; therefore it's been an object of
       | fascination for the ages..."
        
         | KingMob wrote:
         | https://scp-wiki.wikidot.com/scp-061
         | 
         | https://github.com/KingMob/SCP-061
        
       | wrx100 wrote:
       | Does this mean I can now use all/lots of Racket libs in Chez?
        
         | ReleaseCandidat wrote:
         | No. But you (may?) no longer need the special Racket Chez to
         | build and run Racket.
        
       | HwyarkGnuor wrote:
       | Is any software of note built on top of either software? All i
       | can think of are these forums which, while enormously culturally
       | influential, seem unremarkable from a technical perspective.
        
         | sidkshatriya wrote:
         | Even though your question is a bit pointed, I think it is worth
         | understanding what software is built upon Chez and Racket. The
         | answers would be instructional to everyone. Here is some stuff,
         | that I _do_ know -- there is probably a lot more usage in the
         | wild:
         | 
         | Racket is used extensively in education and research relating
         | to Scheme and programming languages in general. Lots of work on
         | gradual typing, programming language semantics comes out of the
         | Racket community. Many colleges around the world use Racket.
         | Scheme/Racket is very pared down language and lends itself to
         | this kind of work -- the principles of whatever you are
         | studying shine through quite easily in a way that it may not if
         | you were using C, Rust, Python etc. in the problem domain.
         | 
         | As noted elsewhere in the comments, Idris 2, an important
         | dependently typed language outputs to Chez/Racket Chez.
         | Previously it output C code which was then compiled.
         | 
         | See:
         | https://en.wikipedia.org/wiki/Racket_(programming_language)#...
         | 
         | In general, Chez is probably a great language to use as a
         | "base". It lends itself to embedding and is performant. Lua and
         | some Javascript implementations come to mind as comparables. In
         | general, we might not know much about Chez being used a lot in
         | the wild because it could be tucked deep into various
         | proprietary company products.
        
         | Bogdanp wrote:
         | I don't know about "of note", but here are a couple pieces of
         | software I've built with Racket:
         | 
         | * https://franz.defn.io/
         | 
         | * https://remember.defn.io/
         | 
         | * https://defn.io/2023/08/10/ann-franz-source-available/
         | 
         | HN itself runs on Racket.
        
           | mark_l_watson wrote:
           | Wonderful projects! I wish I could give you more than 1
           | upvote.
        
             | Bogdanp wrote:
             | Thank you!
        
             | jjtheblunt wrote:
             | You just make me realize, you effectively can.
             | 
             | In the way those Dyson bladeless fans pull more air
             | through. In your case, many folks know you (some from UIUC
             | too like me) and know your upvote is worth reading, ending
             | up upvoting too.
        
               | jjtheblunt wrote:
               | p.s. s/make/made/ courtesy of keyboard typo
        
           | bmitc wrote:
           | > HN itself runs on Racket.
           | 
           | Isn't it an ancient version of Racket, though?
        
             | velcrovan wrote:
             | But doesn't it also work fine, whatever version it uses?
        
               | bmitc wrote:
               | My point, based on the assumption that indeed Arc runs on
               | an old Racket version, is that it doesn't serve as a good
               | example, in my mind, in terms of what you could build
               | with Racket today.
               | 
               | This is a quite common pattern in the Lisp and Scheme
               | world where examples of real world usage are given, but
               | they're effectively outdated.
        
               | gus_massa wrote:
               | Racket has a strong respect for back compatibility, so it
               | should work in the current version. There has been a lot
               | of improvements in the compiler (in particular changing
               | the "back end" from C to Chez Scheme) but it's stil back
               | compatible and sligthly faster.
        
               | bmitc wrote:
               | It is my recollection that the official Arc uses
               | incompatible features. I can't remember where I read
               | this, so it's entirely possible I am incorrect.
        
               | gus_massa wrote:
               | [Another try in case this is the type of answer you
               | wanted.]
               | 
               | In Racket the batteries are included. Two examples of
               | programs I had to write like two years ago for work:
               | 
               | * A bot to reply emails that uses IMAP, SMTP and web
               | scrapping. (It's not 100% automatic. It replies only the
               | easy cases and adds labels so I reply the tricky ones.)
               | 
               | * An program to cleanup Moodle backups that uses gzip and
               | xml. I compiled it and send it to my coworkers. (The
               | backups have too much info, so before restoring it in
               | another site it's better to remove the unused parts.)
               | 
               | In both cases, and all the features were installed by
               | default. There are many user defined libraries that can
               | be downloaded as packages, but I didn't need to use them.
        
               | bmitc wrote:
               | For what it's worth, I am actually a fan of Racket, or at
               | least was. It's what I reach for when I want a Scheme.
               | But I lost enthusiasm for the language when the Rhombus
               | project was announced. I now mainly use F# and Elixir for
               | my side projects. Racket doesn't really provide anything
               | over those two languages for most use cases.
               | 
               | And it's tough to get support as there's very few people
               | who know the stack well enough, and those people are the
               | busiest and also professors, so their time is limited.
        
         | tmtvl wrote:
         | I believe mediKanren
         | (<https://www.uab.edu/news/research/item/10382-a-high-speed-
         | dr...>) runs on Racket.
        
       | cellularmitosis wrote:
       | One of the things which the racket fork added was resurrecting
       | support for OS X on PowerPC. Very cool to be running the fastest
       | scheme on my old iMac!
        
       | rurban wrote:
       | Title. Already merged about two weeks ago
        
       | devnull3 wrote:
       | I had a look at https://racket-lang.org. Where we can download
       | this build? [1]
       | 
       | [1] Assuming that the merge has happened since the announcement
       | was on Oct 16
        
         | soegaard wrote:
         | The main line of Chez Scheme is here:
         | 
         | https://github.com/cisco/ChezScheme
         | 
         | There is more work to be done before release 10.0.
        
         | aseipp wrote:
         | Racket today and for several years now has already been using
         | Chez Scheme, so any of the latest versions you download will be
         | built that way. On all platforms. So, just download away, and
         | you're good to go.
         | 
         | Rather, this announcement is about going the other way around,
         | and about merging changes back into _Chez_ : when Racket was
         | migrated to Chez several years ago, as a matter of practicality
         | they had to fork it and significantly modify it to maintain
         | feature parity with the existing implementation. The changes
         | were very large; multiple new supported ISAs and ABIs, new
         | compiler optimizations, an entirely new build system, etc. For
         | years, nobody was totally clear about what would happen with
         | this fork, but the hope was that it would all go back to the
         | upstream Chez codebase. That is finally happening, and so this
         | post is not about merging code from Chez into upstream Racket,
         | but rather merging code from Racket back into upstream Chez.
         | 
         | The hope is changes will soon be available as a new major Chez
         | Scheme release, version 10.0, and so the fork and the upstream
         | version will finally be unified. (Racket will likely continue
         | to use its own fork of Chez scheme as a practical matter of
         | engineering, but presumably it will only need very minor tweaks
         | and small patches, if any, for it to work.)
        
       | dark-star wrote:
       | TIL that ChezScheme seems to be a Cisco project. Interesting...
        
         | kryptiskt wrote:
         | Cisco bought Kent Dybvig's company some years back and open
         | sourced Chez Scheme (they likely have more profitable products
         | than a performant Scheme compiler and don't need the thousands
         | they could make on such a product).
        
       | randomascoward wrote:
       | Isn't the title "upcoming merge to create Chez Scheme v9.9.9"?
        
       | giancarlostoro wrote:
       | Does this mean that the Racket and Chez teams will merge as well?
       | I always liked Racket, and use it on spare time once in a blue
       | moon (not enough hours in the day), but I am out of the loop on
       | Chez vs Racket.
        
         | samth wrote:
         | It means that Matthew Flatt will become a committer to Chez
         | Scheme, and they plan to include Racket-driven changes. Of
         | course, we plan to maintain Chez Scheme's high standards for
         | quality and preserve all the things about it that are good
         | outside Racket as well.
        
       | LAC-Tech wrote:
       | Wasn't chez scheme the dialect that let you compile scheme code
       | at runtime as a first class thing? I remember looking into this
       | stuff when I had it in my idea to make a configurable text
       | editor.
       | 
       | I know racket is very static in this regard.
        
         | samth wrote:
         | Both Chez and Racket allow you to compile new code at runtime.
        
           | LAC-Tech wrote:
           | Is that new? I'm sure I looked into this last year and it
           | couldn't be done.
        
         | ska wrote:
         | > Wasn't chez scheme the dialect that let you compile scheme
         | code at runtime as a first class thing?
         | 
         | IIRC every lisp and scheme I've used has supported this. It's
         | pretty typical, but not universal.
        
           | soegaard wrote:
           | Evaluating code at runtime is "universal".
           | 
           | But some implementations use an interpreter for evalulating
           | code at runtime. ChezScheme uses the compiler.
        
             | ska wrote:
             | Sorry, typed poorly. I meant "but not universal" instead of
             | "if not universal". Updated now.
             | 
             | What I was saying is that every implementation I have used
             | did this, not that all of them do. It seem common.
             | 
             | FWIW I've done a lot more CL than scheme, though.
        
               | soegaard wrote:
               | Consider the case where a compiler compiles Scheme to C
               | via C. The C compiler is available at compile time, but
               | who knows if the user has a C compiler. Such compilers
               | often solve the problem by using some kind of interpreter
               | at runtime.
               | 
               | Compilers that compile directly to machine code do not
               | have similar problems.
               | 
               | For fun, do you know a Common Lisp implementation that
               | compiles via C? How do they implement `eval`?
        
               | ska wrote:
               | Yes that's an obvious problem, but manageable I suppose
               | by installing a toolchain or insisting on one when you
               | install.
               | 
               | The post I was replying to was about scheme's in general
               | though, not scheme->c implementations, right? Anything
               | with an intermediate language _or_ machine language
               | output avoids this problem...
               | 
               | At any rate, the CL's I've used most have native
               | compilers. I think GCL is CL via c, but can't remember
               | the details of its implementation. In any case 'eval and
               | 'compile are not equivalent, and the system may change
               | whether or not 'eval compiles first or just interprets,
               | depending on settings.
        
               | soegaard wrote:
               | As you point out, it's quite common for Common Lisp
               | compilers to produce machine code directly. In the Scheme
               | world that's more rare and made Chez Scheme stand out. I
               | think, that's what LAC-Tech hinted at - but I am not
               | sure.
        
               | LAC-Tech wrote:
               | Exactly what I was hinting at (Well i was trying to say
               | it outright but obviously not using the right words!)
        
               | ska wrote:
               | I've guess I've used MIT and Chez which were native, and
               | chicken and bigloo which are (from memory) going via c.
               | So maybe biased my feeling that native wasn't that
               | unusual. But yes, imprecision in the original may have
               | caused confusion.
               | 
               | [update] I was curious, so had a look at
               | https://get.scheme.org/
               | 
               | Not sure how complete that list is, but that has 4 native
               | compilers and 3 scheme-to-c, which I guess leaves the
               | other dozen or so interpreted, but that gets muddied with
               | intermediate languages and retargetable (e.g. gambit).
        
       ___________________________________________________________________
       (page generated 2023-11-06 21:01 UTC)