[HN Gopher] Four Lectures on Standard ML (1989) [pdf]
       ___________________________________________________________________
        
       Four Lectures on Standard ML (1989) [pdf]
        
       Author : swatson741
       Score  : 126 points
       Date   : 2025-03-30 08:14 UTC (14 hours ago)
        
 (HTM) web link (www.cs.tufts.edu)
 (TXT) w3m dump (www.cs.tufts.edu)
        
       | toolslive wrote:
       | Studying SML should be part of the entry examination for
       | programming language designers. It's old, has its warts, but is
       | still vastly superior to most things that came later. (Type
       | inference? check! Pattern matching? check! TCO? check!.
       | Performance ? excellent!, ...)
        
         | ngruhn wrote:
         | it's crazy, it took "the industry" 30+ years to adopt this
         | stuff
        
           | fire_lake wrote:
           | And they still haven't! Although expressions over statements
           | would be a breaking change - I can't see any mainstream
           | language making this switch.
        
             | tialaramex wrote:
             | Barry Revzin has written a paper to try to give C++
             | expressions like this. It's ugly, even by the standards of
             | C++ but it would work. The rationale is that C++ 29 or C++
             | 32 wil probably get pattern matching and pattern matching
             | doesn't have great ergonomics if everything is a statement
             | rather than an expression. There are plenty of other things
             | C++ will need to fix once it gets pattern matching, but the
             | direction makes sense if you insist on trying to teach this
             | particular old dog new tricks.
             | 
             | Also, I think Rust would consider itself to be a mainstream
             | language, though they aren't techically "making this
             | switch" because the language has always been expresion
             | oriented from the outset. The Book has about two paragraphs
             | about the _statements_ in the language and then a whole
             | chapter on expressions because almost everything is an
             | expression.
        
             | tmountain wrote:
             | Still waiting on real pattern matching in TyoeScript.
        
               | no_wizard wrote:
               | You won't get it till TC39 adopts it
        
             | BalinKing wrote:
             | I actually think it's becoming fairly common these days--
             | IIRC Ruby and Rust both prioritize expressions over
             | statements.
        
           | Almondsetat wrote:
           | do you have any research that points to these things being
           | useful for the industry?
        
             | sudahtigabulan wrote:
             | The languages that were actually adopted by the industry
             | are not exactly full of great useful stuff:
             | 
             | https://www.destroyallsoftware.com/talks/wat
        
         | cmrdporcupine wrote:
         | Having SML (or at least OCaml) as a known language definitely
         | would help engineers when they get into the industry and start
         | using Rust.
         | 
         | Back in the day when I played with these things I preferred
         | SML/NJ over OCaml, but OCaml "won" the battle for headspace.
         | 
         | I'd consider using OCaml for new projects, I really like the
         | language family.
        
         | sheepscreek wrote:
         | It's incredible how much of an understatement it is to say that
         | F# and OCaml were "inspired" by Standard ML. They're
         | practically step-siblings, sharing more similarities than I
         | could have ever imagined.
         | 
         | Edit: Obviously, F# is the step-sibling here, given its half-
         | dotnet parentage. However, they're all solid choices. Their
         | spectacular type inference makes coding in them a very
         | gratifying experience. I can only think of TypeScript as the
         | closest to them among the more popular modern languages.
        
           | moomin wrote:
           | C#'s inference is pretty good these days. As with most things
           | with powerful type inference, you can make a real mess if you
           | put your mind to it.
        
         | rokkamokka wrote:
         | This was the language they taught in our functional programming
         | course while I was doing my CS degree. That was around 15 years
         | ago now. I wonder if they still use it in the course
        
         | nextos wrote:
         | The Little Series, famous for The Little Schemer book,
         | published The Little MLer in 1998.
         | 
         | It's probably their lesser known volume, but IMHO it makes a
         | terrific job at teaching the ML family and its features.
        
       | cantrevealname wrote:
       | FYI for everyone: This is not about Machine Learning. It is about
       | a programming language called Standard ML where ML stands for
       | Meta Language[1].
       | 
       | [1] https://en.wikipedia.org/wiki/Standard_ML
        
         | tialaramex wrote:
         | I was taught the Standard ML of New Jersey (which as a non-
         | American I did not realise is a joke, it's referring to the
         | company now known to you as Exxon, the Standard Oil of New
         | Jersey) at university.
         | 
         | I strongly believe that - although my home institution no
         | longer teaches an ML as first language - this is the best way
         | to teach CS to undergraduates. An ML has all the fundamental
         | ideas you will need to also teach about this discipline, and
         | (so long as you choose e.g. SML/NJ or similar, not Rust or
         | something) it won't be a language the average teenager you
         | recruited might already know, so the week 1 exercise showing
         | they've understood what they're doing is actually _work_ for
         | all of your students, averting a scenario where some of them
         | drift away only to realise at exam time that they haven 't
         | learned a thing.
        
           | sshine wrote:
           | Thank you for sharing this American joke.
           | 
           | Standard ML was my go-to language for many years.
           | 
           | I always found SML/NJ complicated both to compile and use,
           | compared to...
           | 
           | ...well, pretty much every other compiler: Moscow ML,
           | Poly/ML, MLton, MLKit.
        
             | jjice wrote:
             | Agreed - we wrote an ML style language in my uni compilers
             | course and it was taught by the primary maintainer of MLTon
             | (Dr Fluet is a great guy). Since it's full program
             | optimizing, the compilation took a while. He told us to
             | give SML NJ a try for faster compilation but slower
             | execution. It was a headache and only marginally faster
             | compilation for our use case.
             | 
             | That said, it's the OG so I give it some slack. I did enjoy
             | MLton though, but it's easier to do when the instructor
             | wrote it.
        
           | smlismyhomeboy wrote:
           | Huh. As an American, I had just assumed it was because it was
           | developed at Princeton.
        
           | layer8 wrote:
           | > Exxon, the Standard Oil of New Jersey
           | 
           | It would have been fun if they had renamed to JSON instead of
           | Exxon.
        
         | belter wrote:
         | "Generational list of programming languages" -
         | https://en.wikipedia.org/wiki/Generational_list_of_programmi...
        
         | pkal wrote:
         | Not everyone; I'm the kind of person who wishes posts about
         | machine learning would be prefixed with these kinds of
         | clarifications ("watch out, this is not related to the
         | programming language but a family of stochastic algorithms
         | referred to as 'machine learning'"), because I consistently
         | fall for it.
        
       | uzername wrote:
       | We used SML in my undergrad compilers course. I really loved the
       | language and I started exploring other languages outside of class
       | after that.
        
       | swatson741 wrote:
       | Defiantly worth studying SML imo. Pattern matching is a cool
       | feature. Although it's not as comprehensive as most of the
       | pattern matchers in Lisp. You can't match on bitfields,
       | comparisons other than equality by value, etc.
       | 
       | Datatypes are just ok. Classes would be better. It's sort of
       | strange to represent lists (and everything else) as enumerations.
       | It's not really essential or fundamental but I guess that's what
       | Lisp is for.
        
         | ossopite wrote:
         | I suppose by enumerations you mean sum types. I would argue
         | that these are pretty fundamental? you have product types
         | (structs/records/tuples) - a value is made up of x and y - and
         | sum types - a value can be either X or Y. I think the
         | combination of these is what you need to precisely express any
         | concrete data type.
        
           | swatson741 wrote:
           | I did mean sum types, variants, etc. It's not really clear
           | what I meant by representing the data but I'm referring to
           | type inference. SML can't solve the problem, and Lisp doesn't
           | have it.
        
       | msarnoff wrote:
       | My favorite bit of SML trivia: the infix function composition
       | operator is "o" -- lowercase letter o -- so you can write '(f o
       | g)(x)' just like mathematical notation.
        
       | trollied wrote:
       | My CS degree course used SML as the first language to teach
       | everyone in the first semester. Put everyone on the same level,
       | as it was unlikely people would have prior experience. Also made
       | it easy to teach things like recursion.
       | 
       | Really enjoyed it.
        
         | peterstjohn wrote:
         | Ha, same here! It really helped my imposter syndrome, as I
         | overheard a couple of guys talking about the ARM assembly they
         | were doing on their Archimedes on the first day...and I hadn't
         | written anything fancier than QuickBASIC at the time...
        
           | trollied wrote:
           | Was actually lucky enough to be taught by the co-inventor of
           | the ARM cpu. Furber is awesome.
        
             | peterstjohn wrote:
             | For my sins, I didn't actually realise how great that was
             | until quite a bit afterwards! ;)
        
       ___________________________________________________________________
       (page generated 2025-03-30 23:01 UTC)