NullConverter bug ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NullConverter bug ?

Bruno Brasesco
Hi,

I have to re-writte 1 method on NullConverter class

isLeftNullValue: anObject
"Private - Answers whether the argument can be considered the 'null' value
for the left hand side value type."
    ^self leftNullValue = anObject

Because if it's:  ^anObject  = self leftNullValue " like in super class "
This cause an Error because anObject has a special #=, and #self
leftNullValue answer nil.
So,
= anObject
    ^self id = anObject id,  "but anObject isNil "

Is this a bug or Am I doing something wrong ?


Best Regards
Bruno Buzzi Brasesco


Reply | Threaded
Open this post in threaded view
|

Re: NullConverter bug ?

Ian Bartholomew-13
Bruno,

> = anObject
>     ^self id = anObject id,  "but anObject isNil "
>
> Is this a bug or Am I doing something wrong ?

I would say that it is a problem with your implementation of #=. It should
really be something like the following which will prevent the problem you
are seeing.

= anObject
^self species == anObject species and: [self id = anObject id]

or even

= anObject
^self == anObject
    or: [self species == anObject species and: [self id = anObject id]]

Ian