all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: Yuri Khan <yurivkhan@gmail.com>, Emacs developers <emacs-devel@gnu.org>
Subject: Re: [PATCH] Accept plists when serializing and parsing JSON
Date: Sun, 03 Jun 2018 01:34:49 +0100	[thread overview]
Message-ID: <87a7scu2qe.fsf@gmail.com> (raw)
In-Reply-To: <CAArVCkTYP8UbzgeEKL7dHp3ymoL9Za2QpOrx0COaqMJBY1WDdw@mail.gmail.com> (Philipp Stephani's message of "Sat, 2 Jun 2018 10:04:55 +0200")

Philipp Stephani <p.stephani2@gmail.com> writes:

> (a 1 b 2) gets serialized to {"a": 1, "b": 2} and then might reasonably
> conclude that (a 1 :a 2) gets serialized to {"a": 1, ":a": 2}, but that
> would be wrong. It's more obvious and easier to understand to not treat
> colons specially.

I think we should do what json.el does here. It's doing otherwise that
would confuse people.

>>   char *keyword_key_str = SAFE_ALLOCA (1 + strlen(key_str) + 1);
>>   keyword_key_str[0]=':';
> Again, no special treatment for colons please.

No. Because this would, with no obvious reason , defeat the main purpose
of making plists, which is to use them in destructuring lambda lists,
such as the one you yourself chose for json-parse-string.

Regarding the doc comments, I'll do my best to rephrase and use
consistent commas. I'll also add the test you suggested as well.

>>>> talking about, because no part of the library is maintaining any state in
>>>> global variables -- it's read-only from json.c.
>>> after ironing out all [the other?] bugs related to shared state
>>  Which ones? Those seem to be precisely the ones I meant to say are
>>  excluded because the var is read-only.
> It is not read-only. If it were read-only, it would be just a constant
> and not a variable (in the imperative programming sense) at all.

Read some 5 lines above and you will see that what I meant, and indeed
wrote, it's "read-only from json.c"". You may hold another
interpretation, and that's just fine, but by "global state", in Emacs, I
understand things like buffer, point, mark, match data, etc... That is,
I mean exactly what Emacs adds to these functions' docstrings. From
help-fns.el

  (when (or (function-get function 'pure)
            (function-get function 'side-effect-free))
          (insert "\nThis function does not change global state, "
                  "including the match data."))

This is what I mean by global state. Anything else is potentially
erudite bikeshedding in which I'm not particularly interested right now.

>  There are many variables like this in emacs.
>
> Yes, unfortunately. That's no reason to introduce new ones.  Emacs was
> written in simpler times (the 1970s?) when the amount of code in the
> world was much smaller and people didn't yet know everything that we

I really don't think of programmers of the 70's as these simpletons,
quite the contrary actually. Certainly the best programming paradigms
IMHO are those started around that time, in Common Lisp for example,
where dynamic variables abound. But as I write this, I feel the
trappings another bikeshed starting to materialize so I must say that's
just, like, my opinion, man.

João




  reply	other threads:[~2018-06-03  0:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 14:59 [PATCH] Accept plists when serializing and parsing JSON João Távora
2018-05-29 21:20 ` Philipp Stephani
2018-05-29 22:03   ` João Távora
2018-05-30  6:37     ` Yuri Khan
2018-05-30  8:58       ` João Távora
2018-06-02  8:04         ` Philipp Stephani
2018-06-03  0:34           ` João Távora [this message]
2018-06-03  4:05             ` Stefan Monnier
2018-06-03 13:43               ` João Távora
2018-06-02  7:45       ` Philipp Stephani
2018-06-02  7:39     ` Philipp Stephani
2018-06-01  9:39 ` Eli Zaretskii
2018-06-01 23:29   ` João Távora
2018-06-02  6:55     ` Eli Zaretskii
2018-06-02  8:24     ` Philipp Stephani
2018-06-02  9:00       ` Eli Zaretskii
2018-06-02 16:46         ` Philipp Stephani
2018-06-02 19:18           ` Eli Zaretskii
2018-06-08 14:45     ` Eli Zaretskii
2018-06-02  8:30 ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7scu2qe.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=p.stephani2@gmail.com \
    --cc=yurivkhan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.