9.7 Stringifying Macro Arguments

The construction ??Arg, where Arg is a macro argument, is expanded to a string containing the tokens of the argument. This is similar to the #arg stringifying construction in C.

Example:

  1. -define(TESTCALL(Call), io:format("Call ~s: ~w~n", [??Call, Call])).
  2.  
  3. ?TESTCALL(myfunction(1,2)),
  4. ?TESTCALL(you:function(2,1)).

results in

  1. io:format("Call ~s: ~w~n",["myfunction ( 1 , 2 )",myfunction(1,2)]),
  2. io:format("Call ~s: ~w~n",["you : function ( 2 , 1 )",you:function(2,1)]).

That is, a trace output, with both the function called and the resulting value.