From: "Herman, Géza" <geza.herman@gmail.com>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: "Herman, Géza" <geza.herman@gmail.com>, emacs-devel@gnu.org
Subject: Re: Improving JSON pretty printing, how to represent floats?
Date: Fri, 05 Apr 2024 16:25:04 +0200 [thread overview]
Message-ID: <87y19r5138.fsf@gmail.com> (raw)
In-Reply-To: <31866B07-E035-4870-AB91-E7094624E4B8@gmail.com>
Mattias Engdegård <mattias.engdegard@gmail.com> writes:
> 5 apr. 2024 kl. 11.39 skrev Herman, Géza
> <geza.herman@gmail.com>:
>
>> I'm thinking about using the new JSON parser and encoder for
>> json-pretty-print.
>
> Sorry, I didn't read your question carefully enough. Now
> pretty-printing is unlikely to be dominated by JSON parsing or
> serialising
> costs so you could have another all-Lisp implementation that
> keeps numbers exactly as they were written, if that's important.
>
> I doubt it is (and smell gold-plating here).
Maybe I'm not aware of something trivial, but isn't pretty
printing is about parsing and encoding? What else dominates, if
not these?
>
>> What would be the best representation for numbers in this case?
>> I'm thinking about using symbols, but I'm not sure this is the
>> best approach. The parser/encoder would have a new keyword
>> parameter, like ":numbers-as-symbols t". If this is specified,
>> then
>> numbers wouldn't be parsed, but kept as symbols. What do you
>> think, is this a good approach?
>
> Frankly, it sounds dubious at best. Just leave the C code
> alone. Its business is fast conversion; let's not overload it.
What do you mean by overloading? It's simple to add this feature
into it. The parser already supports reading arrays/objects into
different formats, an additional ":number-type 'default" and
":number-type 'symbol" fits the design perfectly, and I really
doubt that it has a significant performance impact. Can be
implemented 10-20 lines of code.
prev parent reply other threads:[~2024-04-05 14:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 9:39 Improving JSON pretty printing, how to represent floats? Herman, Géza
2024-04-05 12:35 ` Eli Zaretskii
2024-04-05 12:53 ` Mattias Engdegård
2024-04-05 12:55 ` Herman, Géza
2024-04-05 13:09 ` Eli Zaretskii
2024-04-05 13:16 ` Herman, Géza
2024-04-05 14:01 ` tomas
2024-04-05 15:34 ` Eli Zaretskii
2024-04-05 16:46 ` Herman, Géza
2024-04-05 13:37 ` Dmitry Gutov
2024-04-05 14:20 ` Herman, Géza
2024-04-05 16:47 ` Dmitry Gutov
2024-04-05 14:18 ` Mattias Engdegård
2024-04-05 14:25 ` Herman, Géza [this message]
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=87y19r5138.fsf@gmail.com \
--to=geza.herman@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=mattias.engdegard@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.