Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] any way to "clear" the toplevel?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: qrczak@k...
Subject: Re: [Caml-list] any way to "clear" the toplevel?
Fri, 27 Apr 2001 09:50:33 +0900, Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> pisze:

> My next point was pointing at a more concrete problem, that you may
> have to solve even if signatures did not change: values in ADT's.

> What is GHC doing about that?

"Interface" is a compiler-generated file. It changes when some
part relevant for compilation of other modules changes, e.g. the
representation of an ADT or the body of an inlined function.

The compiler cares to not overwrite this file if it's the same as
the previous version, to avoid unnecessary recompilation of dependent
modules.

> But I'm not sure whether you can define values at toplevel, in the
> way you do in ML.

You can, but they are forgotten on reloading modules, even if nothing
changed.

Perhaps it would make sense to improve this behavior, but they should
be flushed at some time, because in Haskell, as opposed to OCaml,
later bindings don't normally cover previous bindings of the same
name. They do cover when defined at the toplevel (the toplevel mimics
the body of an imperative function rather than a set of module-level
declarations). It's not obvious how to keep this covering policy on
reloading modules which logically sit behind toplevel-defined names.

It's not really that inconvenient to have these names flushed, because
all changed modules can be reloaded by issuing one command, so the user
can define values intended to last longer in a module rather than on
the toplevel - the compiler remembers how the environment was created
and recreates it as needed. You can't define types on the toplevel,
so it's sometimes necessary anyway.

GHC's interactive toplevel is new: the first version which includes
it was released less than a month ago. Details are likely to change.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr