Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Standard ML of New Jersey weirdness

2 views
Skip to first unread message

Boris Gjenero

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

I've just built the latest version of Standard ML of New Jersey on my
Linux box at home. The build was quite uneventful, but the behaviour is
different from what
we were taught in class. Here's what happens. (Lines starting with :
are from sml, and the rest are my comments):

: Standard ML of New Jersey, Version 110.0.3, January 30, 1998 [CM;
autoload ena
bled]
: - val f = fn x => x;
: val f = fn : 'a -> 'a
: - val g = f f;
: stdIn:21.1-21.12 Warning: type vars not generalized because of
: value restriction are instantiated to dummy types (X1,X2,...)
: val g = fn : ?.X1 -> ?.X1
: - f "foo";
: val it = "foo" : string
: - g "foo";
: stdIn:23.1-23.8 Error: operator and operand don't agree [tycon
mismatch]
: operator domain: ?.X1
: operand: string
: in expression:
: g "foo"

This should have returned foo, right? However, for some reason sml
insists on those dummy types, and and *nothing* has type "?.X1".

: - fn x => x + x;
: val it = fn : int -> int
: - it 2;

This shouldn't have worked. How could sml assume int -> int?

However, things do work properly on descartes. Here's what happened
there:
-----
Standard ML of New Jersey, Version 0.93, February 15, 1993
val it = () : unit
- val f = fn x => x;
val f = fn : 'a -> 'a
- val g = f f;
val g = fn : 'a -> 'a
- f "foo";
val it = "foo" : string
- g "foo";
val it = "foo" : string
- fn x => x + x;
std_in:6.11 Error: overloaded variable cannot be resolved: +
-----

I see that the versions are different. Is that the reason? I hope I
don't have to use 0.93! That version doesn't support Linux or NetBSD,
and I'd have to do a lot of porting to get it to compile. It isn't
worth it for one assignment.

--
| Boris Gjenero <bgje...@undergrad.math.uwaterloo.ca> |
| Home page: http://www.undergrad.math.uwaterloo.ca/~bgjenero/ |
| "Luke, you're going to find that many of the truths we cling to |
| depend greatly on our own point of view." - Obi-Wan Kenobi, ROTJ |

Gordon V. Cormack

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

In article <34DB5954...@undergrad.math.uwaterloo.ca>,

Boris Gjenero <bgje...@undergrad.math.uwaterloo.ca> wrote:
>I've just built the latest version of Standard ML of New Jersey on my
>Linux box at home. The build was quite uneventful, but the behaviour is
>different from what
>we were taught in class. Here's what happens. (Lines starting with :
>are from sml, and the rest are my comments):
>
>: Standard ML of New Jersey, Version 110.0.3, January 30, 1998 [CM;

[snip]

This weirdness may be due to the ML 97 revision. I will investigate.
--
Gordon V. Cormack CS Dept, University of Waterloo, Canada N2L 3G1
gvco...@uwaterloo.ca http://cormack.uwaterloo.ca/cormack

0 new messages