4 ms·
I remember reading this many years ago. TBH I always felt SML was a nicer language, syntactically -- more readable (mainly because of the let..in..end scoping s
by cmrdporcupine 4y ago
I remember reading this many years ago. TBH I always felt SML was a nicer language, syntactically -- more readable (mainly because of the let..in..end scoping syntax) -- and I really liked its Basis library; something about the API choices there seemed to be one of the better collections libraries I've ever used. The "object" part of OCaml didn't feel necessary to me.
But OCaml has had more momentum, and I don't know if anybody is even using SML anymore?
Interesting to look back with a bit of history now, too. Choices like having objects/classes and exceptions (instead of result types) added into OCaml were probably seen as modernizing and adding in features that people expected; but now the pendulum seems to have swung against those features. OOP hype has passed -- e.g. Rust and Go don't have 'classes' with inheritance. And exceptions are also lacking in Rust etc, in favour of Option/Result type + pattern matching, so that control flow is more explicit and easier to reason about.
- zarzavat 4y agoIf I've learned anything as a programmer, is that these things move in fashions. People will get sick of result types and exceptions will be hot again. OOP will be fashionable once again. The grass is always greener on the other side of the fence.
- cmrdporcupine 4y agoThis is quite possibly true, but I feel like exceptions are one of those things... people are just finally cluing into the fact that this is a non-local GOTO, and the consequences for reasoning about program flow can be terrifying, like Djikstra already told us. If exceptions have a "comeback" (they have not gone away in mainstream languages like Java, C#, Python etc.) I hope they come back in a way where they're bundled with static analysis features that help with the reasoning process. When I worked in Java, 10+ years ago, checked exceptions were considered an obnoxious "no-no", and bad style. Mostly because people just wrapped and rethrew them as runtime exceptions. But, like, runtime exceptions are awful, and almost every application I worked in had buckets of garbage in the logs which consisted of uncaught or "caught & logged" exceptions. Such exceptions are particularly troublesome in highly concurrent applications. Exceptions should be exceptional. I think Rust has made the right call here. Handle the error, or panic. Don't make it somebody else's problem.
- xwolfi 4y agoHum, panic as in stop all work ? I like that in Java, units of work can continue after an unhandled exception because you know, sometimes, your software is used by many people in many input variants and say, if you re doing a trading backend, it's bad that you cant fill an order because of a silly parsing bug, but it d be way worse if you had to stop for the day until a dev wakes up and fix it. Log it, and while you fix it the thing still runs for 99% of inputs. Maybe that s what you call "handling" the error ? But it's cool to bubble up the exception because you can share the handler amongst all your downstreams: you may dislike having to do the same exact semi-complex log building everywhere and having it just capture exception at the top most unit of work dispatcher to catch if one threw something to then log and alert your support team in one place, might make sense. Ofc return types can do all that but you contaminate your whole program with handling for bugs you cant well predict the nature off... the only certain thing is that if your program is old and big enough, you'll screw up in innovative ways a general catch will allow to recover from, because you just dismiss the whole input and move to the next.
- cmrdporcupine 4y agoYes, panic, stop all work. If it's truly an exceptional circumstance, it's unlikely that anything further up can "fix it." Don't even try. Kill the process and restart. Or force the author to fix the bug. If it's an "expected" runtime condition that you can manage and recover from, then it's not "exceptional", is it? So don't use an exception. Pass the information to the caller that needs it, and adjust state accordingly. That's my take these days. I've seen too many systems degrade in cascading failures because of misguided attempts to "recover." Deadlocks, partial failures, explosions, etc. Real fun to diagnose.
- xwolfi 4y agoBut what if we need it for critical processes, what if we receive loosely constrained input, what if we want to change it so often that bugs must happen ? (or are you a sort of manager that think bugs can be entirely prevented?) Why are exceptions supposed to be rare ? They re exceptional in the context of what we told the software could happen, but not in the context we're failible humans pissing code as fast as clients can pay us. I never had problem to diagnose a corrupted state following an exception, it's pretty clear. It s much harder to tell dozens of clients that there will no trading in Hong Kong this afternoon because one of them sent an illegal character we didnt think to sanitize, or the exchange inverted two messages against their spec, or a network router dropped a packet. All these are cases I ve seen the last few years, we lost one order in each case, kept the million others trading as normal, handled the potential surprise the next release... Recovery design can be done but you need a strict set of constraints. How do you even recover with a restart after bug fix ? Takes hours just to do, the world has moved on, your states you recovered are useless, you ll sort it the next day ? Maybe imagine a plane software stopping all work because the human pressed two buttons at the same time and the programmer, a human too, forgot this possibility ? Or am I misunderstanding you ? Maybe you work on more one off things like data science when you re the only person interacting with the inputs and outputs ?
- agumonkey 4y ago90s OOP not much but I believe we ran the FP cycle and its ideas have been adopted as much as possible. I think there might be another more mathematical and practical (to cut the verbosity and improve reuse) revival of OO, context/aspect for some bit of meta maybe .. or contracts or multipledispatch.
- cmrdporcupine 4y agoI'm holding out for the wave of logic / declarative / relational programming. That's my nerd preference.
- agumonkey 4y agoOh that could make sense, usually there's the imperative > functional > logic thinking ladder.. and there's scryer, ciao, datalog and a few other logic systems popping up recently. I'd love that too, i'm very much in love with it.
- qualudeheart 4y agoI am highly bullish on systems programming. As high performance computing becomes more important, so esoteric hardware will. I work in embedded and see some of this, as have my friends in the ML space. We’ll see the Zigs, Nims and Rusts of the world mature along with special languages for things like tensor processing units. AI will make it much easier for humans to work using those languages.
- msla 4y agoI think some things are fashions and some are lessons learned. For example, English-like syntax is out. Cobol has it because it was invented for its predecessor and Cobol's still around, SQL has it because its designers copied Cobol before we'd learned better, and that's it. We still use words in our syntax but explicit block structure with punctuation is now known to be easier to read. Speaking of block structure: Line numbers are gone. Unrestricted use of goto (as in, using goto to go from anywhere in the program to anywhere else in the program) is also gone. These things aren't fashion: We've learned better. We're more likely to invent a different kind of structure than to go back to that. Similarly, languages with absolutely no type system are also out: You can have the types on variables, like Haskell, or values, like Python, but choosing to have neither, like BLISS and BCPL, is no longer an option unless you're actually writing in assembly language. Other things, like column-oriented formatting, are gone because technology moved on. Even Cobol abandoned that one.
- weatherlight 4y agoI'm learning SML for a college course right now. I'm pretty smittened, I gotta say. It seems strange to me, that it never took off.
- projektfu 4y agoIt's probably because I'm a chickenhead but I couldn't get the signatures/modules/functors thing working properly and found Haskell a wonderfully easy alternative.
- cmrdporcupine 4y agoI tried to take up Haskell some years after playing with SML/NJ and OCaml, and I just found it ... so hard to read. Not enough syntactic sugar or hints? I wanted to fall for it, but couldn't. That and the community around it was so enamoured with Deep Intellectual Ponderings and Very Novel Arcanities. That was good, sure, but ... hard.
- projektfu 4y agoIt's probably the point-free style that's generally used. I'm not very smart so I need to evaluate them and sometimes expand them in my head with variables. But once you start recognizing some patterns it's easier.
- bmitc 4y agoThe ML languages not taking off are also a mystery to me. F# hits so many sweet spots it makes it hard to find pleasure in other languages unless they offer something drastic like Elixir/Erlang or Prolog.
- agumonkey 4y agoI used to be a lisp head, sexps and paredit were so neat. Then I had a dan grossman sml mooc, it was the first time a language booted lisp outside my taste. Emacs sml/smie made indentation right. Very neat, I wish it could have a second coming.
- cmrdporcupine 4y agoDoes make me ponder how much work it would be to get a new SML runtime built up overtop of LLVM. Assuming someone hasn't done it already. Ah, yeah, it's been worked on before, just found a paper: https://people.cs.uchicago.edu/~jhr/papers/2020/ifl-smlnj-llvm.pdf https://people.cs.uchicago.edu/~jhr/papers/2020/ifl-smlnj-ll...
- shwestrick 4y agoSome of us are still using SML for research and teaching, e.g. https://github.com/mpllang/mpl https://github.com/mpllang/mpl