Thu Feb 18 21:07:23 CET 2010
On 18 February 2010 16:14, Kostis Sagonas <kostis@REDACTED> wrote:
> The situation is currently very problematic for any sort of tool that wants
> to process Erlang source code. For example, tidier (*) that uses the
> epp_dodger module of the syntax_tools application, has trouble in some
> -defines which are considered OK by epp but not by epp_dodger. The most
> common one is those that have commas in what Richard calls their RHS, as in:
> -define(test(X), X =/= 42, X =/= 54, X =/= 666).
> I really do not like this -- and epp_dodger seems to agree with me. Allowing
> the above to be written even without the right parenthesis is even more
Well, if you want to be really strict then epp_dodger is buggy as it
is not compatible with epp which it aims to be. It is a completely
different matter to what epp should do.
For epp you have to decide whether you are going to allow anything on
the RHS upto the ending '.', maybe with a ')', or not. It was decided
to allow *anything* which means that your example is perfectly legal.
Saying that you allow anything *except* open ',' as above and forcing
a grouping just for that case would be very strange and I think lead
to even more confusion.
You have to pick one or the other.
> I do not buy Robert's comments about "this being difficult to change because
> of backwards compatibility", as I have trouble imagining a -define that
> _really_ needs to be without a right parenthesis. Even if some existing
> code does not compile anymore, the fix is just adding a right parenthesis
> that should have been there in the first place!
It is a backwards incompatible change. You have suddenly made a change
which may break old legal code. This is really no difference to making
a syntax change in the language. In this case it doesn't really matter
how justified and right the change is.
> We should not stop being afraid of doing such changes as they are clear
> improvements both for the language, the various tools for it, and for the
> community in general.
Oh, I agree but I have also had the pack after me for suggesting
backwards incompatible changes so I am prepared. I don't see the
problem, you just change your code. :-)
>> At least judging from Ulf's mail, there is a very simple fix to this
> problem, and I urge the OTP team to try this proposed change and include it
> in R14. Perhaps Richard can help by sending a list of -defines in
> Erlang/OTP that are without right parentheses to at least see if there is
> some legitimate reason for them to be without.
There was more to it than that.
It's not the code in OTP which is the problem, the OTP group can fix
that easily enough between releases, the real problem is user code. It
is probably easier to fix the tools.
More information about the erlang-questions