[plt-scheme] Languages: Reloaded

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Jun 17 23:16:41 EDT 2006

At Sat, 17 Jun 2006 18:02:47 +0100, Matt Jadud wrote:
> Hi Robby,
> 
> I have a module-based language that, due to copy-paste reasons, looks a 
> lot like EoPL. It seems to me (for lack of knowledge) that any changes I 
> make to the language require me to re-run 'setup-plt' and restart 
> DrScheme to see those changes.
>
> Is there a more flexible way to develop module-based languages?

EoPL's language isn't a module-based language (in the sense of the
title of 2.1.1 in the drscheme tool documentation). If your language
doesn't need to do what EoPL's does (the comment in the file says that
it needs an extra with-handlers wrapper) then I think you'll want to
actually go with a module-based language, without using a tool% object.
Its a much easier interface to deal with (I put example files at the
end of this file -- there's less stuff there than required for EoPL).

If you do that, you'll find that changes to the module that defines the
language will be picked up by just re-running.

In general, a new namespace is created when Run is created, meaning
that anything loaded into it is going to be re-loaded from disk
(assuming that the .zo files are either missing or up to date).

hth,
Robby

;; both files below go into the `tmp' collection.
;; to change the collection, also change the drscheme-language-modules
;; definition to match the new collection.

(module info (lib "infotab.ss" "setup")
  (define name "tmp")
  (define drscheme-language-modules
    '(("tmp.ss" "tmp")))
  (define drscheme-language-positions
    '(("tmp" "tmp")))
  (define drscheme-language-numbers
    '((550 0)))
  (define drscheme-language-one-line-summaries
    '("tmp")))

(module tmp mzscheme
  (provide (all-from mzscheme))

  ;; after running, change this print and re-run.
  ;; you'll see the new printf
  (printf "hi\n"))  


Posted on the users mailing list.