public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: kawa@sourceware.org
Subject: Re: Questions for Geiser
Date: Tue, 07 Apr 2015 07:58:00 -0000	[thread overview]
Message-ID: <m2fv8c9xp7.fsf@gmail.com> (raw)
In-Reply-To: <5523722A.3040507@bothner.com>

On Mon, Apr 06 2015, Per Bothner wrote:

> On 04/06/2015 10:23 PM, Dan Leslie wrote:
>> 2. What reflection and completion utilities are available, if any?

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")

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.

>> 3. Geiser is very module-centric, and supports behaviours wherein its
>> aware of the R7RS-library or implementation-specific module in which a
>> symbol lays and will rebind it appropriately when a relevant region or
>> other is evaluated. What tools does Kawa provide for, say, declaring the
>> library/module/namespace in which a block is to be evaluated?
>
> Kawa does support R7RS eval and load, where you can specify an
> environment to use,

I think what Dan needs/wants is something like

 (eval '(define (my-function x) ...) (environment '(my own module)))

but Kawa doesn't support this.

Correct me if I'm wrong, but I think once a module is defined it can't
be changed because it's essentially compiled down to a JVM class.

Helmut

  reply	other threads:[~2015-04-07  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  5:23 Dan Leslie
2015-04-07  5:59 ` Per Bothner
2015-04-07  7:58   ` Helmut Eller [this message]
2015-04-07 17:08     ` Dan Leslie
2015-04-07 18:43     ` Per Bothner
2015-04-07 17:04   ` Dan Leslie
2015-04-07 19:01     ` Per Bothner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2fv8c9xp7.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).