[erlang-patches] Epp Bugfix and macros overloading

christopher faulet christopher.faulet@REDACTED
Fri Oct 16 17:16:46 CEST 2009


Robert Virding a écrit :
> I rather like this extension, it is something I always meant to do but never
> got around to doing.
> 
> I am not sure, though, that I completely agree with how you choose which
> definition to use, especially the third case here which I think should give
> an undefined macro error. My reasoning is that if you define a macro to have
> arguments, one or many definitions, and call it with arguments, even with an
> empty argument list then you should only try for the matching definition and
> not take the one without arguments. So if:
> 
> -define(M, a).
> -define(M(), b).
> -define(M(X,Y), {X,Y}).
> 
> then
> 
> ?M        - should use 1st def
> ?M()     - should use 2nd def
> ?M(a,b) - should use 3rd def
> ?M(a)   - should generate an error
> 
> However if only:
> 
> -define(M, a).
> 
> then all calls will use this definition.
> 

Hi Robert,

Thanks for your comments. You are probably right. Your solution is less
error prone and avoids ambiguities.

I made a new patch that takes your suggestion into account. I also
modified some errors to be more precise in diagnostics.

-- 
Christopher Faulet <christopher.faulet@REDACTED>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overload-epp-R13B2-1.patch
Type: text/x-patch
Size: 12576 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20091016/a7dda395/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20091016/a7dda395/attachment-0001.bin>


More information about the erlang-patches mailing list