From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Improving JSON pretty printing, how to represent floats? Date: Fri, 5 Apr 2024 16:18:34 +0200 Message-ID: <31866B07-E035-4870-AB91-E7094624E4B8@gmail.com> References: <87msq8w2zm.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28016"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?Ikhlcm1hbiwgR8OpemEi?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 05 16:19:37 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rskPo-00071s-L7 for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Apr 2024 16:19:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rskOz-0002AK-JJ; Fri, 05 Apr 2024 10:18:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rskOy-0002AA-25 for emacs-devel@gnu.org; Fri, 05 Apr 2024 10:18:44 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rskOw-0004pc-90 for emacs-devel@gnu.org; Fri, 05 Apr 2024 10:18:43 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-516cbf3fd3dso2450913e87.2 for ; Fri, 05 Apr 2024 07:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712326716; x=1712931516; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=0tzBUiZ307sH/WvQd/w7nE6Xd5qih2PWwzTmkzh7ylg=; b=GC5TuQPbhglKTNm0FuplD2ptoGrezdpEVP+xpSzV6X0hRR0MtkxaCz3/lD3Un+knoa 1RqZ1XZYHPAi3K+GMnzNjmWFpa2HMlrCXJPTiAnb/xfGdGzg7CUovDbUcOGgGDKDe0IF t0usckDS4Q40b48R3pX67Je3A2jFlD0xqBc3LPOSQqd/D6WtVPCLr96pvSVyAQ1sUFwM Aip0EoR2P4T93UJowK44v8MaovfIg4AgirZEBvuvXeQcKM7N9aQ0HlXByms5gB1e3g/f X/FOmmOuzn7K1mso9xH2thxtWtrSbfyxhYEjpg6DADIMsXnSUWqcpCxEojkXzmwDQkZ8 RX/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712326716; x=1712931516; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0tzBUiZ307sH/WvQd/w7nE6Xd5qih2PWwzTmkzh7ylg=; b=fTFIgJngiKUSJd0esQGHzmAuWOJFlmSv3S3epOFbj65rd6FI0zQlGvDXspDKhfwBnK V43q94JD2WNSdUT04QMh5wOZLivmFtQj1OLt0BHECYrR3P6R/NXUFKZ9jExgAEEJ2WlP VZp+G0YpH8dVBjDRugotazWarUEzhc54rPk6o6jAw565kFfqt/izEeP7jW+djjzuQgUg C/FH3bR2K60clEz27jG3gPJbkEpxbXmOwx9sPgMR8y/lv5d/ZwC7+STtf0Su7lwaAxD7 Geuu9eHjlzoDesh4EjQ9QyoroTEaZ8FMrwo82nZy1FgvJmLZ7wDg4BeIQZsw1yR9kgSj xsYg== X-Gm-Message-State: AOJu0YyrkinS9wKzxMkXAPg7/hE+zQU6CrJHt0f/yRjPzvRFgEMdhVTB LwcS/8vgrsN58XknfeRCVMSK0yZmfkcQOVuRGeN+qVdnyRSCdzaYs8fNbZrV X-Google-Smtp-Source: AGHT+IGm6OgyklnqbaeZPLS9kdJ7rNYHWkFmO3h+wj6UUWKQXDdh0BQ3gtsXgr9efHvK0VP4kjoRsg== X-Received: by 2002:ac2:4897:0:b0:515:a8e0:bf3c with SMTP id x23-20020ac24897000000b00515a8e0bf3cmr1232508lfc.32.1712326715597; Fri, 05 Apr 2024 07:18:35 -0700 (PDT) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id y11-20020ac255ab000000b00516d2c05b3dsm201428lfg.299.2024.04.05.07.18.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2024 07:18:35 -0700 (PDT) In-Reply-To: <87msq8w2zm.fsf@gmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317549 Archived-At: 5 apr. 2024 kl. 11.39 skrev Herman, G=C3=A9za : > 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). > 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.