[erlang-questions] Getting rid of the preprocessor

Ulf Wiger ulf@REDACTED
Fri May 25 09:31:38 CEST 2012

On 25 May 2012, at 09:12, Vlad Dumitrescu wrote:

> The displaying of fancy colors in the editor is not the important
> issue. An IDE needs to know as much detail as possible about the code,
> to support navigation and refactorings, to be able to suggest
> meaningful completions and offer reasonable ways to fix any issues it
> finds. This isn't possible if one can't understand (=parse) the code
> properly.

Yes - many years ago, I wrote a source code browser for code
stored in ClearCase, allowing you to select a "config spec" and get a 
consistent view of all the code. To make it attractive to our erlang 
programmers, I put a lot of effort into doing syntax highlighting and 
cross-linking of erlang code. You could click on a function head
and get a listing of all call points, for example.

I struggled with what to do with macros. I finally decided to treat
macros and records as similar to functions, and cross-linked them
too. Thus, clicking on a macro invocation would take you to the 
definition of the macro, and from a macro definition, you could 
find all the invocations - same with records.

Personally, I found this very useful, and did put in some work to
try to make it VCS-agnostic (it did handle CVS repositories, 

In the end, though, I gave up trying to maintain it, since I really 
didn't have the time to do so. I also found that after a series of 
unfinished refactorings to make the code more maintainable, it
was more or less *impossible* to maintain. :)

Still, compared to ErlIDE/Eclipse, this tool had pretty shallow 
ambitions as regards actually understanding what the code did.
But just having that level of cross-linking was a great benefit.
Somewhere, there is a cost-benefit threshold, where reaching for
more sophistication simply doesn't pay off.

(At the scale of AXD 301 - 1.5 million lines of code and lots of 
branches in the repos - I felt I had exceeded that threshold when 
my cross-reference database exhausted the inodes on the SUN
server it was running on).

Ulf W

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.

More information about the erlang-questions mailing list