[eeps] EEP 24 revision

Bjorn Gustavsson bgustavsson@REDACTED
Mon Oct 27 16:45:30 CET 2008


On Wed, Oct 22, 2008 at 8:32 AM, Kenneth Lundin <kenneth.lundin@REDACTED>wrote:

> Thanks for the reference implementation but we already have this
> implemented.
> We will look at your implementation and see if it adds something to
> the one we already have.
>

My implementation makes sure that Name/Arity is allowed is allowed only in
attributes and
nowhere else.

/Bjorn

*** erl_parse.yrl@@/OTP_R12B-4    2008-06-10 14:47:26.000000000 +0200
--- erl_parse.yrl@@/main/release/r12b_patch/r12b_otp_7586/1    2008-10-08
16:06:09.000000000 +0200
***************
*** 704,710 ****
      end;
  build_attribute({atom,La,Attr}, Val) ->
      case Val of
!     [Expr] ->
          {attribute,La,Attr,term(Expr)};
      _Other -> return_error(La, "bad attribute")
      end.
--- 705,712 ----
      end;
  build_attribute({atom,La,Attr}, Val) ->
      case Val of
!     [Expr0] ->
!         Expr = attribute_farity(Expr0),
          {attribute,La,Attr,term(Expr)};
      _Other -> return_error(La, "bad attribute")
      end.
***************
*** 715,720 ****
--- 717,734 ----
  var_list(Other) ->
      return_error(?line(Other), "bad variable list").

+ attribute_farity({cons,L,H,T}) ->
+     {cons,L,attribute_farity(H),attribute_farity(T)};
+ attribute_farity({tuple,L,Args0}) ->
+     Args = attribute_farity_list(Args0),
+     {tuple,L,Args};
+ attribute_farity({op,L,'/',{atom,_,_}=Name,{integer,_,_}=Arity}) ->
+     {tuple,L,[Name,Arity]};
+ attribute_farity(Other) -> Other.
+
+ attribute_farity_list(Args) ->
+     [attribute_farity(A) || A <- Args].
+
  -spec(error_bad_decl/2 :: (integer(), attributes()) -> no_return()).

  error_bad_decl(L, S) ->


-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/eeps/attachments/20081027/42f56d12/attachment.htm>


More information about the eeps mailing list