Hi Vlad,<div><br></div><div><div>You are right, it is nearly impossible to properly work with macros in IDE. I never tried erlide. Does it give any coding performance boost? I use sublime2 and emacs. Most of Erlangers uses Emacs (as far as I know).</div>
</div><div><br></div><div>About your example: You can agree within your team which macros you will use and which not. For example:</div><div><br></div><div>1. No complicated code snippets in macros - this is good for code simplicity. </div>
<div>2. All atoms that are flying between modules must be in macros. Or even better - use records for that.</div><div><br></div><div>Simple rules - simple code. Macros are good. They are cool. Use right tool and you have no problems.</div>
<div><br clear="all"><div>Best regards,</div><div>Max</div><br><br>
<br><br><div class="gmail_quote">On Thu, May 24, 2012 at 4:02 PM, Vlad Dumitrescu <span dir="ltr"><<a href="mailto:vladdu55@gmail.com" target="_blank">vladdu55@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Max,<br>
<div><br>
On Thu, May 24, 2012 at 1:44 PM, Max Bourinov <<a href="mailto:bourinov@gmail.com" target="_blank">bourinov@gmail.com</a>> wrote:<br>
> I have relatively big OTP system. I use macros. I don't have any problems<br>
> you described. What I do wrong?<br>
<br>
</div>If you have no problems, then you do nothing wrong! :-)<br>
<div><br>
> I don't debug my code because I think debugging is bad. I do unit tests and<br>
> ct tests. If after those tests there is a need for debug - my tests are bad.<br>
> I do better tests. Will this approach work for you too?<br>
<br>
</div>Yes, I know about that. But there is a debugger and if someone wants<br>
to use it, it should be as useful as possible.<br>
<br>
I have problems with macros because I am working on erlide [*] which<br>
like any IDE that uses the source files and needs also to be as useful<br>
as possible by providing editing help. Source files with<br>
non-restricted macros can't be parsed with normal parsers. Even<br>
putting restrictions on the macro values so that they are well-behaved<br>
requires a context-dependent parsing.<br>
<br>
As one example, how would you parse the following line?<br>
?HELLO(world)<br>
<br>
The answer is that it depends.<br>
With -define(HELLO, hello), it is a function call to hello(world).<br>
With -define(HELLO(Arg), whatever), it is whatever the macro value is.<br>
<br>
This could be disambiguated by requiring all macro references to be<br>
followed by parentheses, like function calls, but that would be<br>
massively not backwards-compatible.<br>
<br>
<br>
<br>
[*] Eclipse based IDE, <a href="http://erlide.org" target="_blank">http://erlide.org</a><br>
<br>
regards,<br>
Vlad<br>
</blockquote></div><br></div>