Joern Huxhorn wrote:

 Marking an object instance immutable
conveys intent. You can build additional logic on top of the
immutability hypothesis. If someone intentionally circumvents
immutability, the ensuing problems are theirs, not ours.
>
That's exactly what I was trying to say in the following paragraph.
Using an ImmutableLoggingEvent interface should be sufficient to mark
that intent. Casting from ImmutableLoggingEvent to MutableLoggingEvent
is similar to using reflection magic.

Only later did I notice that we were in agreement about the
consequences of immutability, i.e. intent ~ contract. Sorry for taking
your comments out of their context.

The distinction you make between MutableLoggingEvent and
ImmutableLoggingEvent does not accurately reflect the distinction I am
trying to make between LoggingEvent and LoggingEventMemento which is
mostly about serialization and only marginally about mutability. Both
LoggingEvent and LoggingEventMemento could be made immutable. I added
the makeMutable() method to LoggingEventMemento as an afterthought.


Joern.

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to