[MLton] cvs commit: improved type constructor names in type errors

Jesper Louis Andersen jlouis@mongers.org
Sat, 27 Dec 2003 02:01:49 +0100


Quoting sweeks@mlton.org (sweeks@mlton.org):
>   
>   Display type constructor names based on the environment currently in
>   scope.  Choose a shortest (in terms of dots) name for each type
>   constructor.  So, when the type name is in scope, the short name will

I welcome this. I generally find the MLton type checker superior to
most other SML implementations. What I do like is the reporting of
differences (much easier to find errors from), instead of similarities,
and the precise:

expects: foo
but got: bar

Take for instance moscow ML:

! Toplevel input:
! 10 + "a"
!      ^^^
! Type clash: expression of type
!   string
! cannot have type
!   int

My brain is always unable to understand this sentence. The fact that
the type the checker wants it to be is at the bottom is hard for me
to cope with. Thanks for making this the way it should be.

Ocaml has a pattern-matcher which reports unexhaustive pattern mathces
with an example of a pattern there is missing. a) Would this be a
thing that would be worthy to add, and b) hard to add? I am not sure
I want that, because I have not generally found any use for it. I just
mention it, so it is not forgotten.

The point is that I, when I am writing SML, have a pretty good idea 
about what patterns one of my functions expects. So when an un-
exhaustive match comes up, I always know what I am missing. It might
be a help to beginning programmers though, but I am not sure if they
are a target for MLton.




-- 
j.