Throwable class design

Sean Kelly sean at invisibleduck.org
Thu Jan 31 16:37:31 PST 2013


On Jan 29, 2013, at 10:49 PM, rumbu <rumbu at rumbu.ro> wrote:

> I have one question regarding the Throwable, Error and Exception classes.
> 
> I cannot understand why members like msg, file, line, info or next are not hidden behind read-only properties or functions. What was the reason behind making these fields public? As far as I know, once an exception is thrown, there is no interest  in modifying contained members.

I think the reason is mostly historic--the original exception classes had public members.  There's no reason why they couldn't be hidden behind read-only properties though, other than the potential to break existing code.


More information about the Digitalmars-d mailing list