[erlang-questions] extending function clauses

Ittay Dror <>
Fri Dec 19 14:59:58 CET 2008


Hi,

Is it possible to add clauses to a function that is defined in another
module?

More elaborately: say a 3rd party module 'geometry' defines a function
'area', for each shape (shapes are defined as tuples where the first element
is an atom naming the shape) there is a clause (so there is a clause for
'circle', 'square' etc.). Now, I have a new shape. Can I extend
'geometry:area' so it can handle my new shape (by adding a new clause). I
cannot change the original module's file. 'geometry:area' is used by other
functions to do more sophisticated stuff (so defining my own area function
is not effective). If not, what is the erlang way of handling this
situation? 

Thank you,
Ittay
-- 
View this message in context: http://www.nabble.com/extending-function-clauses-tp21091060p21091060.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list