I am porting the latest version of NeoJSON to GemStone and I have come across a mapping problem. I know the brute force solution, but it does put a brutish burden on developers trying to use it.
GemStone 3.6 has a number of "Small" classes which fully encode the value in the OOP.
The Number subclasses are all automatically taken care of, but Date, Time, and DateAndTime are problematic. I would like to avoid having programmers explicitly defining custom mappings for each of these classes *and* their regular brethren.
Sven, I am specifically hoping you can jump in and discuss this.
I have one possible suggestion, inspired by #species, and that is have NeoJSONWriter>>#writeObject: use self mappingFor: anObject neoJsonClass rather than just the plain #class. The default implementation of #neoJsonClass would answer the receiver's class. And those places where one needs them can provide their own answer. e.g. SmallDate>>#neoJsonClass would answer Date, and so on.
Of course, if there is a better way, I would love to learn it.