[HN Gopher] Scheme in Scheme on WASM in the browser
       ___________________________________________________________________
        
       Scheme in Scheme on WASM in the browser
        
       Author : paroneayea
       Score  : 120 points
       Date   : 2023-12-15 15:26 UTC (7 hours ago)
        
 (HTM) web link (spritely.institute)
 (TXT) w3m dump (spritely.institute)
        
       | lamerose wrote:
       | Preferable to doing the Javascript edition of SICP.
        
         | odyssey7 wrote:
         | Alas, the focus is on optimizing job placement at graduation,
         | so intellectually engaging choices are lower priority. We're in
         | a situation where CS departments are incentivized to spend
         | every year that a student is in school optimizing their ability
         | to produce BFS or DFS in Python within 15 minutes.
        
           | epgui wrote:
           | Maybe I'm missing something, but it sounds like you're making
           | a general statement from a very specific and personal
           | situation?
        
             | ethanwillis wrote:
             | It's not specific and personal. Obviously it doesn't apply
             | 100% but there is definitely a trend towards rote
             | memorization and single language focus.
        
               | pvg wrote:
               | _definitely a trend towards rote memorization and single
               | language focus_
               | 
               | What's some evidence of this trend you can think of?
        
               | baq wrote:
               | Leetcode?
        
               | odyssey7 wrote:
               | I'd be interested in seeing an analysis that traces the
               | programming language paths built into university
               | curricula and how those paths have tended to change over
               | the years. The weakening of theory components is also of
               | interest. My sense is that the trends are real, based on
               | what I've noticed and conversations with instructors in
               | higher education, but I don't have an empirical dataset
               | to support it.
               | 
               | A decent theoretical model can be extrapolated from
               | Goodhart's law. Graduates' performance on programming and
               | leetcode-style interviews is a measure that many
               | stakeholders care about, so it's a target for university
               | departments that would lose value as a measure of
               | educational quality. As a CS department optimizes its
               | performance on that measure, elements of the curriculum
               | are reprioritized. It becomes okay for the department to
               | sacrifice educational quality in order to enhance
               | performance on the measure. What doesn't go directly into
               | the measure, such as experience outside of a core
               | programming language intended for programming interviews,
               | gets chipped away over the years through market pressures
               | as universities' graduates compete for relative
               | performance on the measure. This is a theoretical model,
               | but to me it's convincing.
        
             | odyssey7 wrote:
             | Well, it's up to the reader to follow the implications. But
             | the industry does hold sway in the design of university
             | curricula, sometimes to the disappointment of academics,
             | and this is nothing new.
             | 
             | For example, back in 2001, Dijkstra expressed his dismay at
             | Java replacing a different functional programming language,
             | Haskell, in UT Austin's introductory programming course. ht
             | tps://www.cs.utexas.edu/users/EWD/transcriptions/OtherDocs.
             | ..
             | 
             | Also consider that MIT used the Scheme version of SICP as
             | their introductory programming textbook for years, and it
             | remains a classic, but nowadays MIT leans into Python for
             | introductory programming courses.
        
               | pvg wrote:
               | Dijkstra was a great computer scientist who was also very
               | generous with his expressions of dismay. You can find him
               | expressing dismay over a great variety of topics not all
               | of which have turned out to merit it in the long run.
        
               | ethanwillis wrote:
               | This says nothing about whether or not this specific
               | instance of dismay is warranted. All you've said is a man
               | can't be right 100% of the time which I don't find very
               | useful.
        
               | lll-o-lll wrote:
               | You have been voted down, but this is 100% truth. I'd
               | been a professional software developer for 10 years and
               | programming since a young child when I stumbled across
               | the MIT Scheme open course (this was nearly 10 years ago
               | now). Learning Scheme as an exercise dramatically
               | improved me as a software developer, as it is the near
               | perfect teaching language. The fundamentals of most
               | computer science concepts are so clearly laid out, with
               | no distractions. I wish I'd had the exposure at a younger
               | age!
               | 
               | MIT Scheme is pretty much useless as a practical
               | language, vastly less useful than Python. Python is
               | infinitely more powerful to actually "make things". But
               | this is not the point of University!
               | 
               | The academic languages are powerful for learning, and it
               | is a huge shame that they are being replaced with
               | "professionally relevant" languages.
        
           | lamerose wrote:
           | Not a fan of Python, but it isn't too bad pedagogically
           | speaking. JS on the other hand... I hope WASM can one day
           | kill it, leave it obsolete, and have it forcefully deprecated
           | like Flash.
        
       | gumby wrote:
       | I only looked at WASM when the spec was first released but at
       | that time it looked like tail call was not possible. Has that
       | been corrected?
        
         | k__ wrote:
         | Seemingly
         | 
         | https://v8.dev/blog/wasm-tail-call
        
           | csjh wrote:
           | Support is still mediocre (mainly because of safari)
        
             | davexunit wrote:
             | Safari will have tail calls, eventually.
        
               | gumby wrote:
               | According to some other comments above, it appears that
               | is already does.
        
               | csjh wrote:
               | In Javascript yes, in Wasm no:
               | https://webassembly.org/roadmap/
        
           | odyssey7 wrote:
           | Nice! Is there hope that V8 will also support proper tail
           | calls in JavaScript?
           | 
           | Update: The ticket for v8 to support JavaScript tail call
           | optimization remains open but hasn't been updated in a couple
           | years. https://bugs.chromium.org/p/v8/issues/detail?id=4698
        
             | k__ wrote:
             | Yes, there were some discussions about explicit tail call
             | optimizations being the better solution.
        
               | odyssey7 wrote:
               | Interesting, why would adding an _optimize this_ keyword
               | to JavaScript be better?
        
               | skrebbel wrote:
               | I don't know their motivations, but having the same code
               | work fine on one JS engine / browser / browser version,
               | but totally stack overflow on another seems like
               | suboptimal to me. Explicit tail calls let you error out
               | properly at the call site, Babel-style downcompile it to
               | a loop of some sort, all that stuff.
        
               | odyssey7 wrote:
               | This could be surprising, but the scenario already exists
               | in production. In JavaScript's strict mode, Safari
               | applies tail call optimization, but systems relying on V8
               | don't.
               | 
               | To illustrate, the following code causes a stack overflow
               | for me in both Google Chrome and in Node.js, but runs
               | without issue in Safari.                 "use strict";
               | const countdown = (n) => n == 0 ? console.log('done') :
               | countdown(n-1);       countdown(100000);
        
               | shadowbanned4 wrote:
               | the same discussion is going on with rust. it lets the
               | compiler enforce that you're actually using a tail call,
               | instead of silently optimizing it when it sees it and
               | otherwise being silent.
        
           | davexunit wrote:
           | Yup! Hoot uses return_call and friends extensively. Chrome
           | ships tail calls as of 119, Firefox will have them on by
           | default in 4 days when 121 is released, and Safari will have
           | them... at some point.
        
       | ryukafalz wrote:
       | This is exciting stuff! It feels like Hoot is moving forward at
       | lightning speed these days. Love seeing all these cool demos.
        
       | dannyobrien wrote:
       | I don't have favorites, but Spritely is definitely an equal
       | favorite for the projects we support at the Filecoin Foundation
       | for the Decentralized Web. Others HNers may also be interested in
       | include:
       | 
       | * Internet Archive's Democracy's Library
       | https://blog.archive.org/2022/10/19/announcing-democracys-li...
       | 
       | * Distributed Press https://distributed.press/
       | 
       | * Guardian Project https://guardianproject.info/
       | 
       | * MuckRack Document Cloud https://muckrack.com/
       | 
       | * Harvard Library Innovation Lab https://lil.law.harvard.edu/
       | 
       | * Human Rights Data Analysis Group https://hrdag.org/data-
       | publication/
       | 
       | Longer list here: https://ffdweb.org/explore/#partners
        
       | wslh wrote:
       | This is amazing. I am not finding the link to open a Scheme REPL
       | in the browser (without doing my developer job). Am I missing
       | something?
        
         | davexunit wrote:
         | The demo is embedded in a iframe towards the bottom of the
         | post. If you are using a browser that is Wasm GC and tail call
         | capable, you'll see something that resembles the gif at the top
         | of the post. If not, you'll see a message about needing to use
         | a different browser.
        
       ___________________________________________________________________
       (page generated 2023-12-15 23:00 UTC)