[erlang-questions] Help - Can I stop this warning?

Lennart Öhman <>
Sat Sep 22 17:04:33 CEST 2007


Hi, the easiest way would be to refrain from using a case when you don't have
more than one branch.

Try

[begin  {_,{_,F,_}}=process_info(self(),current_function), F end]

Another reason not to use your suggestion is that define leads to that the
subtituation gets copied into the locations where you use ?IOFUN. And since F
actually gets exported (since it becomes bound in all (the only) branches)
it might very well mess with another varible F in the variable scoop where
you use IOFUN. What I am trying to say in too many words is that there is
a very good reason for the warning to be there :-)

Best Regards
Lennart


-------------------------------------------------------------------------------
Lennart Öhman                    phone: +46 8 587 623 27
Sjöland & Thyselius Telecom AB   cell : +46 70 552 6735
Hälsingegatan 43, 10th floor     fax  : +46 8 667 8230
SE-113 31 STOCKHOLM, SWEDEN      email: 
-----Original Message-----
From:  [mailto:] On Behalf Of G Bulmer
Sent: den 22 september 2007 16:18
To: 
Subject: [erlang-questions] Help - Can I stop this warning?

I have been playing with this macro to print the current functions name:

-define(IOFUN(), io:format("~s: ", [case process_info(self
(),current_function) of {_,{_,F,_}} ->F end])).

Unfortunately, I get this irritating warning on *every* function, on the first use of ?IOFUN():
./script.erl:34: Warning: variable 'F' exported from 'case' (line 31) ...

Can someone suggest how I get rid of it?

Garry

_______________________________________________
erlang-questions mailing list

http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list