otakana icon

erlang record accessors ?

otakana | PRO | 10/08/20 01:00:51 PM UTC | 0 ⭐ | 17862 👁️ | Never ⏰ | []
Erlang |

260 B

|

None

|

0 👍

/

0 👎

-define(PROPERTY_GETTER(RecType,Field), Field(Rec)->Rec#RecType.Field ). 
-define(PROPERTY_SETTER(RecType,Field), Field(Rec,Value)->Rec#RecType { Field = Value } ).
 
-record(test,
    {
    field1,
    field2,
    field3
   }).
 
?PROPERTY_GETTER(test,field1).

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎