Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Llama Light: a simple implementation of Caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-08-29 (10:52)
From: bluestorm <bluestorm.dylc@g...>
Subject: Re: [Caml-list] Llama Light: a simple implementation of Caml
When using the toplevel, declaration phrases fail (looks like a linking
problem), but expressions work as intented :

> $ llama

        Llama Light version 0.0828

# 1 + 1;;

- : int = 2

# let x = 1 + 1;;

Error: Reference to undefined global `Toploop'

I made my tests using "llamac -i".

I found it startling that the most important difference to my eyes are
buried, on the web page, under lines of relatively boring documentation :

In Llama Light (and in contrast to other Caml implementations):

> - let does not generalize.

- Phrases are generalized immediately. In particular, "let foo = ref []"
> does not typecheck.

- The value restriction is not relaxed. (This is similar to Caml Light.)

> These choices simplify the implementation while having relatively little
> impact on the user.

You cite the "Let Should Not Be Generalised" paper. There is however a
difference in your application of the maxim : in the paper, local let that
have polymorphic type annotations are generalised, while in your system it
is not possible to force generalisation.

I had a look at the typer, and it's indeed rather simple; it seems it would
be quite simple to implement generalized let (when encountering annotations
or with a different syntaxic construct : "letg .. = .. in ..."), but the
added complexity is equivalent to adding let generalization by default.

Is the presence of let-generalization a real issue in your work ?