-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON package is entirely 'private', making inheritance impossible. #107
Comments
Updated by darron.schall on 2009-07-08T15:08:07 Can you describe what you're interested in extending? I'm hesitant to just generically move everything from If I understood better what your end goals are, then I can determine which methods can be safely marked as Added label json |
Updated by wolever on 2009-07-08T19:28:44 I want to extend the encoder/decoder and teach it how to serialize my custom classes (for example, so it will I'm curious, though, what you mean by "keeping the integrity of the library". What do you think would happen if |
Updated by darron.schall on 2009-07-08T20:16:09 I think, in this case, it would be better to add hooks that you can extend for these particular areas. For example, in JSONEncoder the convertToString() private method is a good one to mark as protected. You if ( value is Date ) However, a more complicated method such as objectToString shouldn't necessarily be easily extendable Making convertToString() protected would enable this approach since you can decide in there whether or not That's what I mean when I say "keeping the integrity of the library". I think it's better to expose custom object Unforunately, the way the class is designed, it's hard to "swap out" which encoder/decoder you want to use public static function encode( o:Object, encoderClass:IJSONEncoder = null ):String Let me think about this some more. It warrants some discussion, and would probably be better discussed on Added label Type-Enhancement |
Updated by wolever on 2009-07-09T14:38:56 Agreed – convertToString would be a good place to allow overriding. I think I understand what you mean by "keeping the integrity of the library"... And although I would argue that And, yea – when I did my implementation, I ran into the same problem with the static methods. To get around Anyway, thanks for your work on this library – it's much appreciated. |
Originally filed by wolever on 2009-07-02T21:16:57
It is impossible to (usefully) inherit/extend the JSON module because all the methods are 'private'.
The text was updated successfully, but these errors were encountered: