[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval

From: Dirk Herrmann
Subject: Re: eval
Date: Mon, 5 Feb 2001 01:09:52 +0100 (MET)

On 4 Feb 2001, Neil Jerram wrote:

> Indeed.  Perhaps we could fix the current problem without dirtying
> eval by putting in a special case in the REPL to recognize
> (define-module ...)  expressions.  Or, slightly less hacky, use a read
> hash extension:

Very interesting.  It comes close to the idea of the ,foo syntax that is
used (I think) by SCSH.  However, the advantage of the ,foo syntax is,
that a comma as the very first character of a top-level expression can
immediately be detected as an indicator of some special command, while a
hash character may also indicate the start of any other hash constant, for
example the boolean values or character constants.

We could provide the ,foo syntax for guile, and provide all those ",foo"
commands in a similar way as with read-hash-extend, for example as a
read-comma-extend command.  Your code would then simply be changed to:

> (read-[comma]-extend 'module
>                 (lambda (c port)
>                   (let* ((module-name (read port))
>                          (module (resolve-module module-name)))
>                     (or (resolve-interface module-name)
>                         (error "no such module" module-name))
>                     (set-current-module module)
>                     (display module)
>                     (newline)
>                     '*unspecified*)))

to provide a command ",module <some module>".  It looks as this would
be easy to implement, although I admit that I have never taken a close
look into the reader...

Best regards,
Dirk Herrmann

reply via email to

[Prev in Thread] Current Thread [Next in Thread]