Questions for Geiser

Per Bothner per@bothner.com
Tue Apr 7 19:01:00 GMT 2015



On 04/07/2015 10:03 AM, Dan Leslie wrote:
> In Guile, Chicken and others there are various actions that are only
> available at the REPL, like setting breakpoints and whatnot. Generally a
> comma precedes the method name in order to differentiate it from a
> symbol that could be found in the active environment.

Yes - and I think that is quite ugly.

> Geiser exploits the ability to define new functions of this sort in
> order to avoid polluting the active environment with geiser-specific
> methods. There are perhaps other ways I can avoid name collisions and
> other concerns, but my first inclination was to attempt to describe new
> toplevel functions of this form.

Kawa has compound names and namespaces, which IMO is cleaner:

(geiser:set-breakpoint "foo.scm" 96)

If that is too verbose, a user can define their own prefix:

(define-namespace g geiser:namespace-uri)
(g:set-breakpoint "foo.scm" 96)

>> The Kawa compiler and run-time do quite a bit of reflection.  For example you can
>> import a plain-old-Java-class with static fields (using the R7RS import
>> command), and the static fields become bindings in the importing scope.
>> When you import a module/library, Kawa basically resolves the module to a Java class,
>> and then just looks at the public fields of the class, figuring out the bindings
>> from those.
>
> Very interesting! Are these utilities documented? I was digging through
> the info docs and website yesterday, but I readily accept that I may
> have overlooked it.

At this point, there is no documented/public API.

I've started on a (kawa expressions) library (see the source in
kawa/lib/kawa/expressions.scm).  This is currently primarily used for writing
custom optimization hooks (see kawa/lib/compile_map.scm, which optimizes
map and for-each).  It could be the start of a general expression-reflection API.
It's not documented, as it's fairly recent and a work-in-progress.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list