Re: querying user for string input

From: Erick Gallesio <>
Date: Thu, 16 Sep 1999 18:35:32 +0200 (CEST)


I'm always too long to answer mail, but I was very busy the two last
weeks and it is never good for the mail.

> >>>>> "Andrew" == Andrew Dorrell <> writes:
> Andrew> Use the export clause Luke... Plenty of examples of how
> Andrew> with the STk distro.
> I do, look at the source Obi-Wan.
> I think the problem is that if you use export, you must still use
> import and therefore use modules. In other words export does NOT put
> the variable into the global namespace.
> I just tried it again and it doesn't work, i.e.,
> (import dialog)
> (define get-input (with-module dialog get-input))
> Is required to put get-input into the global namespace.

Of course not, but if the STk module (the one that you call global
namespace) import it you should not have problem:

      STk> (define-module M
             (export b)
             (define a 1)
             (define b 2))
      STk> a

      *** Error:
      unbound variable: a
      STk> b

      *** Error:
      unbound variable: b
      STk> (import M)
      STk> a

      *** Error:
      unbound variable: a
      STk> b

Note that b is visible after the import.

Note also that there is a primitive export-all-symbols which allows
to export all the symbols of a module to those which import it (OK, it
was not documented, but this is done now).

> Since I don't use modules and therefore can't use import, I used the
> ugly hack, which incidentally comes from the STk source (imagine
> that).

I generally use this hack to assume compatibilty with old versions.
For instance, trace and untrace are now in a module (called trace)
since these procedures use a lot of utility routines. At the end of
the file you'll see

    (define trace (with-module Trace trace))
    (define untrace (with-module Trace untrace))

this allow you to see the old interface for traces (without knowing
that there are modules in STk) and hides the utilities to avoid name
conflicts. This is not very pretty but this is what we have to pay to
assume compatibility.

> As to why I don't use modules, well, that's a long story :-)

I, too, don't like too mush the modules, but I was tired to have
students which broke the scheme primitives such as "map" or "append"
(or worse the classical "toplevel") and by side effect the way to
report them the problem with the dialog box.

BTW, have you seen the new console of STk It has a menu which is "New
console in ..."? It attaches a console to a existing module so you can
choose interactively to add symbols in the export list or re-evaluate
a piece of code that you have in a buffer without reloading all the

                -- Erick
Received on Thu Sep 16 1999 - 18:40:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST