Loading ...
Sorry, an error occurred while loading the content.

Re: RE�: [json] __jsonclass__ hinting

Expand Messages
  • meyer_jon
    ... I guess this is our point of departure. You view dynamic data as a 10% rare case that falls outside what you are interested in, one which you hope others
    Message 1 of 2 , Aug 1 5:30 PM
    • 0 Attachment
      > In the 90% case, yes. For the 10% case where the data ends up
      > being dynamic in shape from invocation to invocation, I'm
      > hoping that the frameworks will step in and provide a
      > way to designate a field as the type discriminator.

      I guess this is our point of departure.

      You view dynamic data as a 10% rare case that falls outside what you
      are interested in, one which you hope others will figure out.

      I have a dynamic app - one where the user can turn on and off
      different options, and as they do a single RPC method returns
      different types of JSON objects. Is that really so rare? I don't think so.

      Are others out there doing dynamic data interchanges in JSON like this?

      Type hinting is hardly controversial. As evidence, consider that every
      mature JSON serializer has a way of doing it. JSON-RPC-Java uses
      javaClass:

      {
      "javaClass": "java.util.ArrayList",
      "list": [0, 1, 2, 3, 4]
      }

      Refeed uses "jsonclass":

      {"jsonclass": ["RF_Feed", [{"id": 3}]]}.

      json-rpc.org uses "__jsonclass__":

      {"__jsonclass__": ["MyDate", [2005, 4, 4]]}

      We use "jstype":

      {"jstype": "MyDate"}

      And that's just the problem: right now everyone has a different
      attribute name and slightly different technique for doing exactly the
      same thing - tagging a { } struct with a type name. Surely this this
      is the kind of thing a standard should address?

      Relegating dynamic data to the "10%" case is shortsighted. Sure,
      static data is common. But so is dyanamic data. Addressing dynamic
      data enables a range of richer apps. As JSON matures these richer apps
      are going to dominate.

      Its a bit like a C programmer arguing that, since 90% of data is
      static, and typedef covers that, who needs class? That position stuck
      for many years, and as a result every single C coder had to create a
      homegrown solution for doing classes in C - it was a mess.

      Fortunately, JavaScript is already object oriented. And so are nearly
      all server languages. Expecting data to be static 90% of the time is
      ignoring the nature of the web.
    Your message has been successfully submitted and would be delivered to recipients shortly.