[MLton-user] why sml matters?

Jesper Louis Andersen jesper.louis.andersen at gmail.com
Thu Oct 12 13:50:32 PDT 2006


It is always hard to give such advocacy. First, you have to split the
argument.

The Syntax and Semantics of SML are, in my opinion, really good. I think the
best paper written on this is Appel's 1993 critique of SML:

http://citeseer.ist.psu.edu/context/23485/514371

The HM type system is not the only smart moves made by the language
creators. In fact, the semantics of SML repeatedly chooses a solution one
has a good way of abstracting away or implementing effectively.

In my life of computing, SML, Haskell and Common Lisp are the 3 languages
that opened eyes for me - because they all present an interesting way to
handle the problem of computation.

The Standard Basis Library of SML is somewhat of a failure, since it is far
too small for a modern language. Since the standard does not define anything
of value, the Basis has to make up for it. Unfortunately, it does not. It
lacks, among things: Data structures (A decent finite map and a decent set
structure at least, please), Combinatoric parsing, Output Pretty-printing,
XML processing, database integration, standardized FFI, effective stream
processing, persistence constructions, string handling, etc. It is rather
hard to argue one should use SML when basic stuff is lacking from the
Standard Library. Java might be a very weak language (I think it is), but it
makes up for it with a great standard library.

Further, you will at some point end up with functionality you would like,
but should not be put in the standard library. For this to work, you need to
begin a library process. Perl choose CPAN, Java has Maven (
http://maven.apache.org) among things. Common Lisp has ASDF, Haskell has
Cabal. All systems provide means to package libraries and have your system
download cryptographically signed packages for injection into your system.
Since there are no such movement for SML, it is hard to argue one should use
the language for anything substantial (In academia and special purpose
projects, these omissions are not that important -- so SML works rather well
there). Scheme R5RS has the very same problem, which is the primary reason
for the dispersion of schemes.

The last thing I think is seriously lacking is hot-deployment or dynamical
loading of source code into a running image, as well as introspection and
decent debugging. What makes eg Common Lisp and Erlang powerful are exactly
these features. Any problem drops you into a debugger in Common Lisp
(through the magnificient SLIME environment for Emacs) and you can then
alter the function, recompile it into the image and restart it. Often this
makes it a bliss to build a piece of code. In Erlang, errors will be
supervised and the faulty process restarted. This ensures the system runs on
and lowers the number of total crashes. Further, one can hot-deploy a
process by sending it a message with a new version of itself as an argument.
The Java J2EE environment is not as neat, but it does provide hot-deploy of
new code revisions.

--

You can see that I've talked about 4 things here, of which SML only has
focused on one, namely the first. You can't win any advocacy argument
against someone who deems the other 3 necessary for a software development
system. Some might even demand the existence of an IDE in Java-Eclipse
proportions.

The greatest power of SML is that the specification of the language is
formal as Operational Semantics. It shares this rather unique property with
JavaScript/EcmaScript. Many projects in academia is served well by the
property.

Another good property is that SML is *fast*. The ML family has some really
good implementations in MLton and OCaml and they are remarkably quick.

Beware of touting static typing as an advantage. Many people (including me)
are not convinced that static typing is the way to make programs, though I
admit it has some compelling features. This holds even with HM on the type
system.

SML is also *small*. It took me 2 years to begin being fluent in Common
Lisp. I can't speak C++ well. Haskell still has me look up stuff now and
then. When programming SML I never need to open a book. Much can be argued
over the elegance and beauty of a small language versus a big one. I like
Common Lisp a lot and it is dead-effective, though its ANSI standard is all
but small. I'll just note that there are very few "elegant" languages that
became mainstream. The list of Java, Python, Ruby, Perl, C#, C++, C and PHP
shares the trait of having a rather involved language standard. However,
"elegant" specifications are popular in academia: SML and Scheme RnRS are
prominent examples.

I hope to have at least tickled your mind with this.

J.

On 10/10/06, Buday, Gergely Istvan <gergely.buday at siemens.com> wrote:
>
> Hi there,
>
> this is slightly off, but in the long term might gather new mlton users.
>
> I gave a lecture on sml here and got the criticism that I could not
> convince them why to use it. Could you please suggest relevant
> literature that I could make a compilation for the not yet converted of?
> Speaking about the greatness of Hindley-Milner type system does not help
> here too much.
>
> - Gergely
>
>
> _______________________________________________
> MLton-user mailing list
> MLton-user at mlton.org
> http://mlton.org/mailman/listinfo/mlton-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton-user/attachments/20061012/6dbdacd3/attachment.html


More information about the MLton-user mailing list