These are chat archives for jsog/jsog

29th
Jul 2015
Moody Salem
@moodysalem
Jul 29 2015 00:43
Cool :) Maybe the JS implementation should be converted to follow the same algorithm?
Jeff Schnitzer
@stickfigure
Jul 29 2015 01:48
Why? The JS implementation works great and the unordered-dict algorithm is less efficient.
Moody Salem
@moodysalem
Jul 29 2015 03:18
JavaScript objects by definition are not expected to preserve any kind of key order, so the implementation is susceptible to bugs with changes to JavaScript engines
Plus it seems cleaner to use a single algorithm with reference implementations in multiple languages, otherwise it's not clear how to implement this in other languages such as Objective-C
Jeff Schnitzer
@stickfigure
Jul 29 2015 05:21
I'm aware that the official JS spec does not define ordered behavior of maps. I'm also aware that all JS engines in existence actually do enforce this behavior, and in fact there's a famous release of a past version of Chrome that relaxed this behavior, caused a ton of problems, and they quickly re-instituted the behavior. So the de-facto JS standard is that objects are ordered; I challenge you to find an engine that does not enforce this constraint.
Furthermore, ES6 makes the ordering constraint explicit. So I think we're safe for the future too.
The JSOG javascript code is for production use, so no, it will not be given an unnecessarily complex and inefficient algorithm. There are plenty of code examples in several different languages, including one (Python) that has unordered dictionaries. Anyone should be able to work this out. Sorry.
Moody Salem
@moodysalem
Jul 29 2015 11:33
Okay, then your documentation needs to be fixed to indicate that JSOG relies on the REFs appearing in order. And this line in particular is incorrect, "JSOG is 100% JSON. No special parser is necessary." JSOG is not JSON, it's an enhancement on the spec because the parsers make assumptions that are not true of JSON. Oh and all those people that are agreeing on the reasonable constraint that you should not program based on unstable assumptions are also wrong and you should collect your upvotes. Not to sound rude but I don't think this is at all unreasonable
Also younare relying on
Also you are relying on the JSON parser to preserve key order, and a quick Google shows that is not consistent where poly fills are used
A library for production use shouldn't have such a glaring issue-you can create "valid JSOG" according to the README and have the parser choke on it because it wasn't created by the generator you provide
Moody Salem
@moodysalem
Jul 29 2015 11:38
I will fork it and write the implementation for the general case
Jeff Schnitzer
@stickfigure
Jul 29 2015 15:37
If you can find a single platform on which this javascript code fails, I will take this concern seriously.