[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160621095244.6563e26b@xeon-e3>
Date: Tue, 21 Jun 2016 09:52:44 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Anuradha Karuppiah <anuradhak@...ulusnetworks.com>
Cc: Roopa Prabhu <roopa@...ulusnetworks.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
Julien Fortin <julien@...ulusnetworks.com>
Subject: Re: [PATCH iproute2 net-next v3 1/5] json_writer: allow base json
data type to be array or object
On Tue, 21 Jun 2016 09:24:50 -0700
Anuradha Karuppiah <anuradhak@...ulusnetworks.com> wrote:
> On Tue, Jun 21, 2016 at 9:12 AM, Stephen Hemminger
> <stephen@...workplumber.org> wrote:
> > On Mon, 20 Jun 2016 23:39:43 -0700
> > Roopa Prabhu <roopa@...ulusnetworks.com> wrote:
> >
> >> From: Anuradha Karuppiah <anuradhak@...ulusnetworks.com>
> >>
> >> This patch adds a type qualifier to json_writer. Type can be a
> >> json object or array. This can be extended to other types like
> >> json-string, json-number etc in the future.
> >>
> >> Signed-off-by: Anuradha Karuppiah <anuradhak@...ulusnetworks.com>
> >
> > Since json writer is not used in many places yet, why not just
> > get rid of the automatic object in the constructor.
>
> I wanted to force the external api to start with an json-object or
> json-array. It reduces the chance of mistakes vs. a typeless
> constructor. With a typeless constructor you can accidentally end up
> with a json output that doesn't pass json lint; especially if optional
> params are being suppressed at different places.
Still, this is not how jsonwriter works in .NET, Android, or Java.
It is easily confusing to developers if similar API's behave
differently. Kind of like if printf() always appended a new line
on some platforms.
Powered by blists - more mailing lists