[erlang-questions] No Namespace for Macros
Zoltan Lajos Kis
Thu Oct 15 20:04:35 CEST 2009
You could stick to name your macros as modulename_macroname.
case X of house -> ?valueHouse_Value;
car -> ?valueCar_Value
sapan shah wrote:
> Erlang does have the concept of namespace for the functions( we do
> Why does it not have this concept for macros?
> Consider this scenario: I have an application which deals with the value of
> some things. (lets say a house & a car)
> So, I define macros in two different files for the things.
> -define(Value, 10).
> -define(Value, 2).
> Now, My application file could be something like this
> -include("valueCar.hrl"). %% This will not compile... ll give 'redefining
> macro error'... assume it is allowed in erlang
> star(X) ->
> case X of house -> ?valueHouse:Value;
> car -> ?valueCar:Value
> This is just a cooked up example. One may have this kind of need in a big
> For exapmle, Java supports this (public static final variables).
> Any Explanation?????
> Sapan Shah
More information about the erlang-questions