← Back to team overview

dolfin team mailing list archive

Re: Expression and Function

 

> On Wednesday 04 November 2009 09:37:55 Garth N. Wells wrote:
>> kent-and@xxxxxxxxx wrote:
>> > Hi, I am very happy with the  Expression, but old code like
>> >
>> > class Dabla(Function):
>> >     def eval(...)
>> >
>> > still works.
>> >
>> > The only problem is that the function is zero even though eval is
>> > implemented. Is it
>> > possible to turn this old code into an error?
>>
>> In C++, no. There is no mechanism in C++ to prevent a user overloading
>> or hiding a member function.
>
> In Python, using meta classes, yes.
>
> This is a nice exercise for those of you who want to get to know meta
> classes
> in Python. ;) If and when I have time I can fix this. (Heading for the
> states
> next Tuesday)
>
> Should we allow sub-classing of Function, but not overloading of eval?
>
> Dr. Hake
>

Dr. Hake,

I like the title!
I think it should not be possible to overload eval if it is not used.

Kent





References