Hacker News new | past | comments | ask | show | jobs | submit login

JSON doesn't support behaviour (methods). They are very useful for composing programs IMO.



Methods are useful to organise and abstract programs, they're really quite bad at composition. Many functions operating on the same primitives is much more composable than small sets of functions operating on their own custom primitives.


Behaviour could be implemented by shell commands. That way, if you wanted to implement a method for a particular object, you could just write a binary/shell script/whatever that reads the object from stdin and writes its result to stdout


Then you'd need a JavaScript interpreter. Which would be terrible.


Well, it doesn't have to be JS specifically. In theory, it could even be a piece of machine code.


if the deserialization mapped to a system wide type system then the methods could be mapped in at that point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: