Transient property attribute
On 6/6/07, Kris Zyp <kriszyp at xucia.com> wrote:
Would it be possible to add a property attribute "transient"? It would not need any special treatment, it would serve purely as a marker. Java has this as a property attribute/field modifier, and it is very helpful for defining what fields should be included in persistence/serialization. The only implementation detail that this might effect is that I believe that it would be most proper if "toJSONString" ignored properties that had been marked as "transient". So if one declared an instance variable: class A{ transient var b } b would not be included in toJSONString serializations, and other persistence/serialization strategies could use introspection to be aware that such values should not be saved. Any chance this could make it in the spec?
As this is probably just one more approach to customizing JSON serialization, and we're not trying to do much with that (despite extensive debate on that list), my guess is "no".
The transient property is not just for JSON serialization, but gives an abstracting indication of transience that is important for any future persistence, serialization, or mapping mechanisms (which could include libraries or future language additions). Thanks, Kris
Would it be possible to add a property attribute "transient"? It would not need any special treatment, it would serve purely as a marker. Java has this as a property attribute/field modifier, and it is very helpful for defining what fields should be included in persistence/serialization. The only implementation detail that this might effect is that I believe that it would be most proper if "toJSONString" ignored properties that had been marked as "transient". So if one declared an instance variable: class A{ transient var b } b would not be included in toJSONString serializations, and other persistence/serialization strategies could use introspection to be aware that such values should not be saved. Any chance this could make it in the spec? Thanks, Kris