caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk)
To: caml-list@inria.fr
Subject: Re: [Caml-list] any way to "clear" the toplevel?
Date: 27 Apr 2001 04:03:33 GMT	[thread overview]
Message-ID: <slrn9ehrsl.8am.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <20010427095033Q.garrigue@kurims.kyoto-u.ac.jp>

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


      reply	other threads:[~2001-04-27  7:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-25 20:35 Chris Hecker
2001-04-25 23:56 ` Chris Hecker
2001-04-26  1:05   ` Jacques Garrigue
2001-04-26  1:18     ` Chris Hecker
2001-04-26 12:46     ` Marcin 'Qrczak' Kowalczyk
2001-04-27  0:50       ` Jacques Garrigue
2001-04-27  4:03         ` Marcin 'Qrczak' Kowalczyk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrn9ehrsl.8am.qrczak@qrnik.zagroda \
    --to=qrczak@knm.org.pl \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).