Overriding functionality
Alex Arnon
alex.arnon@REDACTED
Sun Aug 21 14:39:24 CEST 2005
On 8/20/05, orbitz@REDACTED <orbitz@REDACTED> wrote:
> I had a situation in a python project where for 99% of the uses of this
> class, the programmed behavior was perfect. But for a few situations
> one of the member functions of that classes needed to use an alternate
> object. On top of that, we didn't even know it needed that until we
> came across it with one of our clients broken interfaces. To solve the
> problem all I had to do was subclass the object and override that
> function. Is there any common erlang idiom for this? This being,
> basically, inheritance I guess. I'm not looking for an OO model
> really, I don't think, but sometimes it does seem easier to simply
> override functionality. How is this situation even dealt with in a
> language like erlang?
>
> Thank you
>
>
(Note that I speak as a newbie, so take this with a pich of salt :) )
The simplest answer is "it depends on what type of component you are
working on" but generally, Erlang/OTP encourages the use of symbolic
indirection and behaviours to obtain any type of entity behavioural
inheritance. I think you can use import+export module attributes in
order to more easily simulate behaviour inheritance (is this
correct?).
More information about the erlang-questions
mailing list