I was thinking about how things like function or variable renaming are
complicated by lisps macros. That it's almost impossible to track the
scope of anything, since 2 symbols near each other might mean
completely different things after macro expansion.
So I came up with an algorithm that *might* work in the most common
case. Is there a flaw in the idea, or did I overlook any major aspect
of the language? Any idea of which IDE would be the best to try and
prototype it?

Here it is in pseudocode:

select symbol in source that you want to rename
parse the code
add tracking meta-data (file, line, position in line) into all symbols
of the tree
expand all macros
find selected symbol: it's either a definition in a def form or let*
or letfn form, or a variable being
used
if the symbol is a definition, find all places where it is used,
taking scope into account
   use metadata to find where the symbol was in the source code
   if it wasn't, it means a macro expanded it into place, so fail
   else rename it
if the symbol is a variable, find where it was defined, taking scope
into account
        use metadata to rename it, if there is none, fail
        find all symbols that refer to the definition, rename if there is
metadata, fail otherwise

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to