This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions for Geiser


Helmut Eller <eller.helmut@gmail.com> writes:
> One possibility is to enumerate the locations in an environment:
>
> (import (only (kawa regex) regex-match))
>
> (define (completions regex env :: gnu.mapping.InheritingEnvironment)
>   (let ((result '()))
>     ((env:enumerateAllLocations):forEachRemaining
>      (lambda (loc)
>        (cond ((instance? loc gnu.mapping.NamedLocation)
> 	      (let* ((sym (loc:getKeySymbol))
> 		     (name (sym:getName)))
> 		(cond ((regex-match regex name)
> 		       (set! result (cons name result)))))))))
>     result))
>
> (completions #/^con/ (interaction-environment))
>  => ("constant-fold" "cond-expand" "cons" "cond")

This is exactly what I was looking for.

> Another approach would be to only use "static" analyses ie. use the
> compiler to parse source files and work with gnu.expr.Expression trees
> without actually loading code.  I think the "static" approach is what
> Per prefers/recommends and it's also what Eclipse and the like do.  If
> you want to do sophisticated dependency management and type based
> refactoring it's the way to go but for simple things like symbol
> completions of top-level bindings it requires much more work than to
> inspect the runtime directly.

That's not an approach that's quite in-line with how Geiser is tailored;
it's more of a suite of tools to extend the REPL into your editing
buffers. The act of repeatedly injecting sexps into the REPL and so
modifying the active environment is central.

Type-based refactoring and dependency management isn't within the scope
of the mode, just yet.

> I think what Dan needs/wants is something like
>
>  (eval '(define (my-function x) ...) (environment '(my own module)))
>
> but Kawa doesn't support this.

Hmm, that's what I was looking for. No matter, we've already set
precedent for enabling/disabling features on a per-scheme basis.

Thanks!

-- 
-Dan Leslie


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]