Can't pass a record to a macro?

Tony Arcieri tony@REDACTED
Sat Jan 9 22:21:16 CET 2010


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?

-- 
Tony Arcieri
Medioh! A Kudelski Brand


More information about the erlang-questions mailing list