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: SchemeScript and code completion


Helmut Eller wrote:
* Per Bothner [2007-11-07 06:38+0100] writes:

Since I write lot of Scheme code that interfaces with Java, the Java
method completion is quite useful. Actually, If possible, Schemeway
should do it even better, such as completing not only static method
names, but also normal method names as in
(let
     ((l :: <java.util.List> (make <java.util.LinkedList>)))
   (l:add 42))

in this case, the l:add could be autocompleted.
That requires integrating the compiler (specifically
type checking) to be integrated with the IDE, which
is difficult.

Could you explain why that is difficult? Is it difficult because the internals of the compiler aren't prepared for such use or perhaps because Scheme/Kawa is hard to analyze?

Basically, both.


My naive approach to perform the above completion would be to parse
the source file --with something like kawa.lang.CompileFile:read,
ignoring non-parseable source for the moment--, then use the current
cursor position to find the corresponding node in the syntax tree, and
finally enumerate (somehow) all method/variable names accessible in that
node.  What do you think of such an approach?

The problem is the last step. That requires macro expansion, resolving names to declarations, and type propagation. I.e. most of the compiler (before you get to optimization and code generation).

You really want to use the compiler for this, rather than half-heartedly
trying to duplicate the compiler's logic.  I'm sure this is doable, but
I think it's more complicated than a weekend hack.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


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