SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
782 stars 46 forks source link

Add Immutable attribute #664

Closed SteveDunn closed 6 days ago

SteveDunn commented 2 weeks ago

https://www.linkedin.com/feed/update/urn:li:activity:7186999196959350784?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7186999196959350784%2C7189688995688165376%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287189688995688165376%2Curn%3Ali%3Aactivity%3A7186999196959350784%29

SteveDunn commented 6 days ago

There are no attributes available to categorise a type as immutable. An attribute could be added, but it could not be enforced.

Value Objects are designed to be immutable. I now think what the original post is saying is to somehow mark records as immutable as a replacement for Vogen generated types. This would also exclude other functionality that Vogen generates, such as usage constraints, code analyser 'fixers', type converters and other serialisation helpers, and hoisting of functionality from the primitive that is being wrapped.