reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Weimer <mar...@weimo.de>
Subject Re: Is it a good idea for toString() to return null?
Date Tue, 05 Jan 2016 19:32:39 GMT
On 2016-01-05 09:34, Mariia Mykhailova wrote:
> Any opinions? Personally I feel we shouldn't return a special value 
> for an otherwise good class which for whatever reason failed to 
> serialize, so we should either fall back to old conversion style or 
> throw an exception

We can't change the definition of `toString()`, so that is out of the
question. We also don't want to return `null`. I think throwing an
exception is in order here:

If we silently fix the serializer with hand written code, we then have
to maintain this forever, negating the benefits of a serialization
library in the first place. At the same time, this code really should
never throw exceptions in real use. Hence, getting a bug report for when
it does seems very useful :-)

Markus

Mime
View raw message