[pro] definitional home

Bob Kerns rwk at acm.org
Tue Mar 29 22:08:04 UTC 2011


I don't mean to discourage innovative thinking here, but for reference,
consider that the editor and/or separate source indexer can locate defXXX
forms, and record the location of (define-widget cool-widget ...) as
(:definition (:name cool-widget :type define-widget) :location (:file
"file.lisp" :line 28)), and make it available to meta-dot.

While I can see advantages to having a form record where it came from, as
you guys are describing, there's also a huge disadvantage -- the need to
actually expand (and possibly evaluate) that macro, before being able to use
meta-dot.

You'd *like* to be able to edit code which is only conditionally loaded, or
intended for some other platform or environment, or not yet working. Let's
say, you just modified (and broke) the define-widget macro,and now you want
to look at its usage -- but you can't, because you can't load it, because
the file define-widget itself is in is broken and won't load.

You'd even like to be able to index forms which are read by neither the
compiler nor the interpreter. You may have definitional data which you want
to constrain to certain definitional types, and NOT allow arbitrary
evaluation (for example, it may be from an untrusted source).

That said, it's typical for compilers and interpreters, in many languages,
to record source locations. This has advantages when no source is available
-- for example, reporting stack traces. Sometimes you can even detect
version-mismatches between source and binary as a result. But I don't think
it's ever the optimal solution for a development environment.

Eclipse sort of does both for Java -- if you have a jar file with binaries,
you can associate it with a directory or jar with sources; otherwise, it
indexes the sources as it parses them, collects cross-reference data, etc.
(It also constructs cross-reference data for the .jar files, so you can find
usages within methods within classes in compiled jar files).

So I'd say, what you really want here is, not a run-time or read-time
action, but rather a declarative hint to both compiler and editor, that a
particular form is definitional.

The simplest, and traditional way to do that, is to simply declare that
forms beginning with 'def' are definitional. It's arbitrary -- but it's
simple.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20110329/453c5979/attachment.html>


More information about the pro mailing list