From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: JSON->lisp Mapping: Hash vs AList Date: Sat, 16 Dec 2017 22:38:53 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1147dcacba79dd05607cc8a2" X-Trace: blaine.gmane.org 1513463834 11591 195.159.176.226 (16 Dec 2017 22:37:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 16 Dec 2017 22:37:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 16 23:37:09 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQL4v-0002lo-MH for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2017 23:37:09 +0100 Original-Received: from localhost ([::1]:52393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQL6t-00037R-OS for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2017 17:39:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQL6n-00037I-5e for emacs-devel@gnu.org; Sat, 16 Dec 2017 17:39:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQL6m-0005kv-7O for emacs-devel@gnu.org; Sat, 16 Dec 2017 17:39:05 -0500 Original-Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:37034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQL6m-0005kB-1Q for emacs-devel@gnu.org; Sat, 16 Dec 2017 17:39:04 -0500 Original-Received: by mail-qk0-x22e.google.com with SMTP id i130so14417156qke.4 for ; Sat, 16 Dec 2017 14:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gZUW1RfHSW2l8wkUv8PI9h5ZRL3Vuhv3R9mwK6pvwEY=; b=HwtouVpM+KPwrV2ABpKFmaoBQzR5Ob+K4gofLcSZMltpWUlWKI0GN+3kEPfwO8GCkJ L0h08rtSSlVZA1zj7RCMZhwhc3ghRixnFfIhKSpIOp2l1z1JGNeivL3ZOa2NmT7VytZM EVc68ahbVAm86xc5wHoAFgWKZp1vEz4yql92RsKx9oCJUjCcOQTL9uJylzNo9piXaqN3 64HOA2Rzf9CaFcx9H6QAUiZHarNj+7oDPgXhizhLYKNKlS136W5tHLxjOPiffMm9VXLr sDs9fC+VyzvFGSa6NR6eIqDx0PvcuPX4zZcrlcOHcA5WDufL7dC1RD1XooqIY7YL0NrI vyjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gZUW1RfHSW2l8wkUv8PI9h5ZRL3Vuhv3R9mwK6pvwEY=; b=NoTScG1rL49i70wXQJ9dzHiYC+6Frz2MxRnrZkl9ich7Mgsntnu0xmJEW4YoATRw3e ZutJ7gr1j0SOLqosJuesU11P799cCxJ0UaERYSYKmFRSULQHKylUNggLHag31wrA9eLS TFGNbc5RU99Eoaxpb2w1pwDIvaxAlf9JjniYK5qnai6HB08qRI77M8wXcgqatBzEtbFs RJcrp/x3x41aWzTwVn7AmBOWyHDYxkIDMwaky9bXwvXrkg6/hkGq97N48aiDhrynhaZk uSaMsHQoWSseSHgpWVAgPRfrdFwdne2BN6Zw7i4GJOdwjxIVJEdVZcf/pxpuG4ae3tQb rC1g== X-Gm-Message-State: AKGB3mK1aERJ1KzU0me3RtaDuNo2+x0bIZMzjK1uCoMPYDOaYSpv0CMN /gvGKooDQxOeBFIa/8nPSqWvlFOY2d3alEL4B1+jHw== X-Google-Smtp-Source: ACJfBotug9vKk8jkcSFlhE04ujTDH5uqaSuDHYjxZ2wzN2FoDYAoH6yRYlSCUrD3s0om023228jlHFM3CP2lSQBmDDs= X-Received: by 10.55.31.131 with SMTP id n3mr4920640qkh.274.1513463943427; Sat, 16 Dec 2017 14:39:03 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221158 Archived-At: --001a1147dcacba79dd05607cc8a2 Content-Type: text/plain; charset="UTF-8" Stefan Monnier schrieb am Sa., 16. Dez. 2017 um 23:36 Uhr: > > -@defun json-parse-string string > > +@defun json-parse-string string &key (object-type 'hash-table) > > Emacs generally avoids keyword arguments. > > I consider them acceptable only for macros (where the cost of parsing > arguments is acceptable since it's done at compile time) or for > function which both need many optional arguments (so positional > arguments are unwieldy) and whose runtime is significant enough that > parsing keyword arguments is a non-issue (e.g. make-process). > > Given that there's only one optional argument here, I'd rather have it > be a &optional one. > > I don't like optional arguments. They make the call sites less readable, because it becomes less clear what the meaning of an argument is. I don't care about saving a few nanoseconds; that's premature optimization. --001a1147dcacba79dd05607cc8a2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Stefan= Monnier <monnier@iro.umontr= eal.ca> schrieb am Sa., 16. Dez. 2017 um 23:36=C2=A0Uhr:
> -@defun json-parse-string string
> +@defun json-parse-string string &key (object-type 'hash-table= )

Emacs generally avoids keyword arguments.

I consider them acceptable only for macros (where the cost of parsing
arguments is acceptable since it's done at compile time) or for
function which both need many optional arguments (so positional
arguments are unwieldy) and whose runtime is significant enough that
parsing keyword arguments is a non-issue (e.g. make-process).

Given that there's only one optional argument here, I'd rather have= it
be a &optional one.


I don't like optional arguments. They = make the call sites less readable, because it becomes less clear what the m= eaning of an argument is.
I don't care about saving a few nan= oseconds; that's premature optimization.=C2=A0
--001a1147dcacba79dd05607cc8a2--