Closed bil-bas closed 14 years ago
Stopped overriding to_json in range. Added a to_rave_hash method. Before serialization in an operation, etc, to_rave_hash gets called if the item responds to that method. This way we can still have the default to_json functionality in range without having to re-implement recursive to_json serialization with a to_rave_json strategy.
Creating to_json on user-created classes is fine and dandy. The problem comes when standard classes are given overloaded to_json. Although this streamlines the code, it might cause problems when the user wants to communicate with external applications in json and suddenly standard classes like Range aren't being serialised in expected ways.
Either:
Currently only Range has to_json replaced (in blip text operations), but Array (in WAVELET_CREATE) is being manually converted to avoid this very issue. Hash could also benefit from being converted in certain circumstances, but it could not have its to_json replaced, since all the other classes uses its standard behaviour in their to_json routines.