RFR: json patches introduced to the OpenJDK copy in JDK-8246435

Magnus Ihse Bursie ihse at openjdk.java.net
Thu Jun 4 07:32:56 UTC 2020


On Thu, 4 Jun 2020 05:45:09 GMT, Erik Helin <ehelin at openjdk.org> wrote:

>> Ah, sorry, now I see what you mean. You want a concat(JSONArray a) instead. Well, it might be good to have, but that
>> does not really solve my problem, does it? :-)
>
> Well, if you have `append(JSONValue v)` and `concat(JSONArray a)` then code using such an API can easily have the code:
> 
> void appendOrConcat(JSONArray a, JSONValue v) {
>     if (v.isArray()) {
>         a.concat(v.asArray());
>     } else {
>         a.append(v);
>     }
> }
> 
> I'm fine with having `appendOrConcat` in `JSONArray` as well, but then I want it named `appendOrConcat`, not `append`.
> I agree that `append` is shorter, but it is too misleading of a name IMHO for a method that really does
> `appendOrConcat`.

I still don't get it. Your example code would not recursively inline arrays; it will only work for a single nested
layer. I can't see how that would be helpful to anything but the most specific situations. What is it you want to
achieve?

-------------

PR: https://git.openjdk.java.net/skara/pull/636


More information about the skara-dev mailing list