Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@NEETzsche It's probably #to_s.
I attended a talk by Evan Phoenix, and he said that before he did Rubinius, his first attempt at implementing Ruby was to start with the parser, which took him a year and was never completed. He eventually restarted and decided to just steal the MRI parser and he had a working implementation in no time.
If it's just a Hash, that's not too hard, but I don't envy anyone attempting to parse Ruby from JavaScript, especially if their shit's that haphazard. (Just wait until they do something that eventually results in `{a: 1/0.0}.to_s`. At least `{a: 1/0.0}.to_json` throws an error. Ha, or `{a: Date.today}.to_s #=> "{:a=>#<Date: 2022-07-25>}". It's really nice to be able to have mixed-type hash tables but if they're sending them over the wire, there's no telling what you'll have to try to parse.)