[erlang-questions] Can't pass a record to a macro?

Zoltan Lajos Kis <>
Sat Jan 9 22:25:35 CET 2010


The result of this macro call is
#bar{}#bar.baz

What's that supposed to mean?


Tony Arcieri wrote:
> I was surprised when this didn't work:
>
> -module(gib).
> -export([gib/0]).
> -define(foo(Bar), Bar#bar.baz).
> -record(bar, {baz=42}).
>
> gib() ->
>   ?foo(#bar{}).
>
> I get the following errors when compiling it:
>
> ./gib.erl:7: syntax error before: '#'
> ./gib.erl:2: function gib/0 undefined
> ./gib.erl:4: Warning: record bar is unused
>
> Is this not supported?
>
>   



More information about the erlang-questions mailing list