From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Newsgroups: gmane.emacs.devel Subject: Re: Regexp bytecode disassembler Date: Sat, 21 Mar 2020 21:16:02 +0100 Message-ID: <875zex79bx.fsf@gmail.com> References: <4201DF24-BCC4-4C08-9857-38207B7C10B4@acm.org> <83mu8bdriv.fsf@gnu.org> <68FB4EC3-3C67-4D07-8473-5FC671024515@acm.org> <834kuhecsr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="81600"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 21 21:16:25 2020 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 1jFkXf-000L6R-NP for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Mar 2020 21:16:23 +0100 Original-Received: from localhost ([::1]:40474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFkXe-00005A-OJ for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Mar 2020 16:16:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46705) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFkX4-0007vm-35 for emacs-devel@gnu.org; Sat, 21 Mar 2020 16:15:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFkX3-0000Tl-5I for emacs-devel@gnu.org; Sat, 21 Mar 2020 16:15:45 -0400 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:36923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFkWz-0000RE-Mv; Sat, 21 Mar 2020 16:15:42 -0400 Original-Received: by mail-lj1-x229.google.com with SMTP id r24so10281516ljd.4; Sat, 21 Mar 2020 13:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=sXbQNQYjolXJBoofGdbW0oNuBugBI3bG1Q+xU8nGfu4=; b=k7y7ZuWaRsMzIzqUo1/FhO51Ad6YUvZOZhbSAG4xDRxcnA2yLe5dDhMrY+VsrXiS4L NJEhO9fHP8yKHL4zXLCSBuUie4nAD5Phns3Sb7ddx0ZvNIKJ9rPLWE6InOA8KIY+0hOI reMTYXw+N83GSf1dvcV4d+23lirfWl7zRvmgrBR2nZdHuX5bYePrufcCK5YsnnLJFfE2 gYQw4mpx3NpCxz0UVyQiAqzl5ndqwt6v6IRmxp9okjDDU4hkBlmlOiI7i+a+LmIv5gr+ va1JIJlHtluxsiVGzH+JYFaZNuFkgfpgJ65O5O8otCmxE/3QraO/3nN2MSzjPqYoB9+k QNrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=sXbQNQYjolXJBoofGdbW0oNuBugBI3bG1Q+xU8nGfu4=; b=QC1qXzONXC6dhFd6ojM3mI62BsbyYV0ACAzsNErpHhoGcWKvri2dB0ES8ZaRo3S5eg QkuMCtoiXL+VZWRQUmZhS4/0tBjYLjwjS+TdVKAcVcdv0XNMOSMfYA0vkrCp/EOzeeL0 5UCaMZ+y8fGkejaq4x2BMmVrJUPOCghsG0L774kiAUkHPIzRKl+94BDI69Cs67O5B6l4 V4tNEqY1FGBkRkcHFn1ugn8lTQfub+NKOwGb6o2Lh2EZUY416TaECHFzv/iCFLD87TUa cTW1pbT0h5XKFD4vwCHq9VAWjzho9JqHt+dsxVpUn2wiYQLP2Rl+TX4+1+h2qBKhSgNv KMrw== X-Gm-Message-State: ANhLgQ0I4YWjpvgkp1KJOAlc/7USNAtbPzXO+z3UlekwDse5S988G17Y nVtehfsNNH9fwVZMy/ItV0/Iz1jU X-Google-Smtp-Source: ADFU+vvMSvIgt7ekjufqNbmS3dl0Q4Ejp1p82yYwQBJE8te/7Sya0UZF06kvNsavxqoZX1HiSMxc6Q== X-Received: by 2002:a2e:7a0c:: with SMTP id v12mr9054997ljc.274.1584821739667; Sat, 21 Mar 2020 13:15:39 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id o4sm5762630lfl.62.2020.03.21.13.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Mar 2020 13:15:39 -0700 (PDT) In-Reply-To: <834kuhecsr.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 21 Mar 2020 21:19:16 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:245639 Archived-At: On Sat, 21 Mar 2020 21:19:16 +0200 Eli Zaretskii wrote: >> >> + (pcase opcode >> >> + (0 (cons 'no-op 1)) >> >> + (1 (cons 'succeed 1)) >> >=20 >> > Is pcase really needed here? It looks like a simple cond will do. >>=20 >> Well, pcase is a lot more readable here, don't you think? > > No, I don't, not in this case. You are just selecting from a list of > fixed values. Please forgive my intrusion, but, while I tend to agree with most of your other comments, I find this one very surprising. Do you mean you would prefer to use `cond' and rewrite all those clauses to something like the following? (cond ((eql opcode 0) (cons 'no-op 1)) ((eql opcode 1) (cons 'succeed 1)) ... Maybe readability is much more subjective than I thought, but I find the latter very suboptimal, to say the least. Also, isn't "just selecting from a list of fixed values" precisely the reason to use some sort of case/switch instead of the general `cond'? Certainly `pcase' can also be useful in more complicated use cases, but it will expand to the cond form anyway, so I also don't see any performance concerns. --=20 =C5=A0t=C4=9Bp=C3=A1n