Open nathvi opened 6 years ago
Wouldn't even need to tag a class - just seeing that this class has been passed through a Tell
call would be enough to flag it as having to be immutable.
Perhaps seeing that a class has been passed through Tell
could mark the class with an AkkaMessage
attribute and refactor all mutable properties as immutable as part of the code fix. This way if that class isn't currently being called with Tell
, the developer still knows that it should be marked to enforce the immutable nature.
I think, that having some sort of [Immutable]
attribute in core Akka repo would be useful in longer run. Even just to make that intent explicit.
I know that right now messages are only kept immutable by convention and are not enforced by the compiler. I'm thinking that it would be a cool project to work on an extension where you tag a class with a AkkaMessage Attribute and the extension could automatically throw an error if it wasn't completely immutable, and give a code fix to make it immutable.