Discussion:
[Larceny-users] incremental development in ERR5RS/larceny
Jose A. Ortega Ruiz
2009-03-15 03:30:30 UTC
Permalink
The way i like to hack in Lisp is by incrementally (re)define my
programs using a REPL. In implementations i use providing some form of
namespace or module facility (such as CL, Guile or s48), i'm able to
evolve interactively my programs by evaluating forms in environments
circumscribed to a given namespace/module. I'm sure you're all familiar
with this kind of thing.

Now, i'm wondering to what extent such an interactive way of hacking is
possible in ERR5RS and, in particular, its Larceny incarnation (R6RS
being out of the question since it ditchs the REPL). If i'm
understanding things correctly, the ERR5RS "equivalent" of, say, a CL
package would be an R6RS-style library. What i would like is to be able
to eval or re-eval a library A's body forms individually, so that other
libraries using A would use the new definition automatically. But that
doesn't make sense for libraries, since their evaluation semantics are
defined as a whole, and they must be reloaded as a whole when modified,
right?

So, if i'm getting this right, the closer i can get in Larceny to my
ideal world is re-compiling and re-loading the library at hand (and all
the libraries that import it) everytime i modify any form in its body or
import/export specifications. And it actually makes no sense to think
about evaluating expressions in a library's namespace (as you would do
for instance in s48 with ,in, or in CL after an in-package form).

Is that a true or, on the contrary, there's a way to use Larceny in the
incremental fashion i covet?

Cheers,
jao
William D Clinger
2009-03-15 19:45:48 UTC
Permalink
Post by Jose A. Ortega Ruiz
Now, i'm wondering to what extent such an interactive way of hacking is
possible in ERR5RS and, in particular, its Larceny incarnation (R6RS
being out of the question since it ditchs the REPL). If i'm
understanding things correctly, the ERR5RS "equivalent" of, say, a CL
package would be an R6RS-style library. What i would like is to be able
to eval or re-eval a library A's body forms individually, so that other
libraries using A would use the new definition automatically. But that
doesn't make sense for libraries, since their evaluation semantics are
defined as a whole, and they must be reloaded as a whole when modified,
right?
Right.
Post by Jose A. Ortega Ruiz
So, if i'm getting this right, the closer i can get in Larceny to my
ideal world is re-compiling and re-loading the library at hand (and all
the libraries that import it) everytime i modify any form in its body or
import/export specifications.
Right. In native Larceny, you wouldn't have to compile the
changed library, because native Larceny compiles everything
it loads.

Note, however, that re-importing the library won't do anything,
because libraries are imported only once. You really would have
to call the ERR5RS load procedure (which you can import from the
(larceny load) or (err5rs load) libraries) to load the library
after making the change.

And then you'd still have to import the library again to make
the loaded library replace its original version in your REPL,
and you have to re-load (not re-import) all libraries that
depend on the changed library as well.
Post by Jose A. Ortega Ruiz
And it actually makes no sense to think
about evaluating expressions in a library's namespace (as you would do
for instance in s48 with ,in, or in CL after an in-package form).
It might make sense, but there would be a lot of questions
about its semantics, and there is no provision for it in the
R6RS, in ERR5RS, or in Larceny.

Will
Jose A. Ortega Ruiz
2009-03-15 21:00:03 UTC
Permalink
William D Clinger <***@ccs.neu.edu> writes:


[...]
Post by William D Clinger
Post by Jose A. Ortega Ruiz
So, if i'm getting this right, the closer i can get in Larceny to my
ideal world is re-compiling and re-loading the library at hand (and all
the libraries that import it) everytime i modify any form in its body or
import/export specifications.
Right. In native Larceny, you wouldn't have to compile the
changed library, because native Larceny compiles everything
it loads.
Note, however, that re-importing the library won't do anything,
because libraries are imported only once. You really would have
to call the ERR5RS load procedure (which you can import from the
(larceny load) or (err5rs load) libraries) to load the library
after making the change.
And then you'd still have to import the library again to make
the loaded library replace its original version in your REPL,
and you have to re-load (not re-import) all libraries that
depend on the changed library as well.
I see... it's almost as if i were implementing DrScheme's model with its
'Run' button restarting the interpreter after each change. Which might
be the right thing to do, after all.

Does it happen to be a way of asking Larceny for a list of loaded
libraries as well as their import lists?
Post by William D Clinger
Post by Jose A. Ortega Ruiz
And it actually makes no sense to think
about evaluating expressions in a library's namespace (as you would do
for instance in s48 with ,in, or in CL after an in-package form).
It might make sense, but there would be a lot of questions
about its semantics, and there is no provision for it in the
R6RS, in ERR5RS, or in Larceny.
Understood. In my opinion, it'd be very nice if future revisions of the
Report brought Scheme closer to the CL/Smalltalk model, in which you
work most of the time inside a living program, continuosly morphing it
into completion. I'm a bit surprised about what i perceive as a gulf
separating CL and Scheme in this regard, specially with the advent of
R6RS; but i've been interested in Lisp only for a few years and maybe
it's a misconception due to lack of perspective on my side.

Cheers,
jao

Loading...