4 ms·
ML was conceived as a solution to the main problem faced by mathematicians using automated theorem provers: that because of the type-free, dangerous, cavalier n
by joe_the_user 15y ago
ML was conceived as a solution to the main problem faced by mathematicians using automated theorem provers: that because of the type-free, dangerous, cavalier nature of the usual language for that domain (Lisp), you could never be sure that your program was going to work.
I'm a c++ person but I'm curious how folks feel about this statement from the article.
- anon_d 15y agoI've written several (toy) compilers in both Lisp and Standard ML. I completely agree with the statement. Mostly, algebraic data types are a huge win for representing expression trees.
- calibraxis 15y agoHe claims, "ML programs can't crash the system; if it compiles, it will run, and you won't get a segmentation fault." Does that mean there's static safeguards against out-of-memory errors? (This is not snarky; I don't know ML or how it handles this situation.)
- tomjen3 15y agoOut of memory errors generally don't happen on modern systems. What happens is that you end up using so much swap that the program becomes so slow that the user cries himself to sleep or something.
- mhd 15y ago> Out of memory errors generally don't happen on modern systems. Well, unless we're talking about smartphones or virtualized environments (e.g. VPS). Both not very relevant in a compiler context, of course.
- calibraxis 15y agoYesterday, I got a Java error about running out of heap space, when I was testing a Clojure program on an extreme case (to test its limits). (Which of course runs in a VM, but I'm not sure you meant the JVM.)
- groovy2shoes 15y agoThe error doesn't mean that your system is out of memory. The JVM allocates a glob of memory at startup to allocate objects from, and is configured with a maximum heap size. If you run out of heap space on the JVM, you can relaunch the java process with a higher max heap size using the -Xmx option.
- tomjen3 15y agoI agree on smarthphones (but then those are not really computers) but I don't think there is anything that prevents you from using swap on a vps...
- mhd 15y agoDoesn't OpenVZ run without swap? Never mind that you can run out of swap, too…
- mas644 15y agoThe point he's trying to make is that Lisp lacks typing. In Lisp, code is data and data is code. This is what makes it so powerful. At the same time, the lack of certain safeguards found in ML can make it dangerous. ML was meant to give the flexibility of a language like Lisp but with stronger guarantees for safety. However, I think it's a bit extreme to say a Lisp programmer could never be sure that their program was going to work...that's just disingenuous. Lisp is a dynamically typed language, but it is a safe language. To contrast this with C++. In C++, if I call some third party mystery function, I'm not sure if it'll cause some side effect and corrupt my process memory. I can arbitrarily create a pointer, cast things to whatever I want, do some memcpys and memsets and bring the whole thing down. Not to say they're bad languages, I'm a C++ guy myself...but a lot of the security vulnerabilities in operating systems and major libraries/apps is due to the fact they're written in C or C++. Languages like ML and Lisp prevent that.