[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loss of abstraction



On Wed, 24 Aug 2005, Michael Sperber wrote:

As someone pointed out, how do you point to the location of

(

  3
      4
)

In principle, I think attaching location only to identifiers is enough to do this, /if/ we give the programmer access to the full source (or optionally some parsed representation of it). Given the location of the keyword at the head of the macro invocation, the user can then walk from there as she sees fit. (The head location could also be a dynamic property of the current macro invocation rather than being part of the identifier.)

In fact, if programmatic access to source information is a good thing, I would say this is the ultimate in source tracking, and the current practice of attaching as hoc information piecemeal to syntactic data is but a poor approximation to it ;-)

The problem with taking syntax objects as the parsed representation of the source is that it that it has limits. There are aspects of the source that do not fit naturally into syntax objects as they are currently understood.

On the other hand, given the full source, we can do all kinds of nice things: displaying error messages with code fragments as the user typed it, with comments and whitespace, including some of the surrounding code for easier identification of the context; extracting comments, bracket type, whitespace, presence or absence of dots, etc.

Cheers
Andre