From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: [External] : Re: Conditional binding and testing of `lexical-binding' Date: Sun, 2 Jan 2022 23:01:15 +0000 Message-ID: References: <874k6mjomk.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17503"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: Po Lu , LdBeth Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 03 00:03:17 2022 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 1n49sj-0004KR-Ck for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Jan 2022 00:03:17 +0100 Original-Received: from localhost ([::1]:48676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n49sh-0007cz-Dt for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 18:03:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n49qx-0005Vm-GN for emacs-devel@gnu.org; Sun, 02 Jan 2022 18:01:27 -0500 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:22436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n49qt-0002zu-4i for emacs-devel@gnu.org; Sun, 02 Jan 2022 18:01:27 -0500 Original-Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2029Bhin018682; Sun, 2 Jan 2022 23:01:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=IYou42hm1NL910/A4vZck3ysmL+YCt/Ppp/WpqsYJMU=; b=rzdIBWV5dUD1u/1pVoj/Edf2XWEuwG83Oh4AZvpSlGiHSPsji7p+8GV3SBS45tK+wyCO sA/WqpUJcY+wMnLSs4IqtFVbqgMy607y9j/cPvPltDl5gJ53cJJKuXS9jBHdsoU9Q9yA /EG0uwHoVYS8hrUxSFPQAPk42Ov7UJuEsukkLj1tACte5EsPN+4pCnWCfzKirjZQcyTk 9nRLRUGVyEyulrZzvBpqUSG7UB1+NtHgLhIxlU5NwnPRtVG2Sd5w9lfwUdqNniNbqnQn fBanHLiaRM+Xd71O5E5XCO3OiAqnB84RlbazuaVOl1WvuZB7x0n1BEjcJbfDJSB7UIVj dw== Original-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3dadr89nwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jan 2022 23:01:18 +0000 Original-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 202N19vv167761; Sun, 2 Jan 2022 23:01:17 GMT Original-Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by userp3020.oracle.com with ESMTP id 3dagdjr93f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jan 2022 23:01:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hW9Zrz/KEIXyARn5NIT4WEoVE7IZ1ZDC8e8kew9YiZm8t/pC5ppuJ61PmDs6vQd7ilu6eHoR+hyPeRZysAQIqxejlcwo43aGYDojsMcOWkKRuVtpX9sVhIcWCxlHW5u5bq9Dn7iiX9J1LgIl9EAzcJfBDKGw+M8dx0dBBrgfy3lswsHffjhe6jFPkpVycpYdO7pSXK+M8yvuAQMCPW/M126h5V/cUKva10I0u2dScUTOl9iChPhXHTrYnJDY6UKIvsHgPO8rUI/WvR82jilkQT9P0t+oXwwHYN/RgMrOiJ3/M44IF9ffPC0zOq1hcYdr803LcIqlqOqyaBsVbSO3Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IYou42hm1NL910/A4vZck3ysmL+YCt/Ppp/WpqsYJMU=; b=ZvHEXrK5bgfPX7wruzbRC0FqXhV5U9E9o3nTXWURADXZtRf4Tfwj0iSjHnInie9un0vPjME6zVLDcj6NrIXpnwMx+/SLj7/qVa6BOZyMBg0bCV5byOon1qWgTbT+fQMBawEcKufF8PYWDOZEEnU5HE/XV0JM/UhQsnVZXR8q2mwvY8qgibaYbj9FUvWdQhtnV29TIrJ69riV1oXTAnyawfPcAuuJkrWbcm+4W8fiRV+k23VRtWoWzFIrlV6d6C0l4Syiq+6JQdy7ZlO5btw+1Gy225ugsy24Ni1bZyLBkCxd5EHmz4lJqkZcjYx5J75zBY67aipY1FWysvPotX1WYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IYou42hm1NL910/A4vZck3ysmL+YCt/Ppp/WpqsYJMU=; b=Sz8RrzDpsRXx8wzHUPS/jMIu5PnAY0VVRXN34otzQoERC1eWUVfw71XBNYCQdqBnuBkYYWB74wu4WxZSAYuVdRZRX7QWGrwO1Y7hx/DvzQ4d7MFn7/HZG1ij2uMEC1oxljvTMg5eawjlQ6LsJX13xQp6VimdDOLGYYWr96iQHZA= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.13; Sun, 2 Jan 2022 23:01:15 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::99a4:696f:5f30:36b3]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::99a4:696f:5f30:36b3%7]) with mapi id 15.20.4844.016; Sun, 2 Jan 2022 23:01:15 +0000 Thread-Topic: [External] : Re: Conditional binding and testing of `lexical-binding' Thread-Index: AQHYACykl+jASylD90ONpWo26FqSWg== In-Reply-To: <874k6mjomk.fsf@yahoo.com> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 10cf645f-b4d5-4f54-bfd9-08d9ce43c77b x-ms-traffictypediagnostic: SJ0PR10MB4495:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AyWhkCmtX3LmLZivKpoRXft42884UKYINruPx1VI9h9K3c7OJZx3NuAFSDdUwffAT+gEmT5bffOTfh+hbry3SSTb7UyGHzQ//VkCBta2RiejjX6/wVzmQb/rCUAQvNMRGBgAcn3HajSzOjy+AgfAcNkLCqXPgsZ4b4NWidVXZjU3Vi+AS50v4c/J8mf4NHf5mU7jMLxoj0CYyRz2gsv7MG3UQTSx6nTv2ZrERjbWG5szqCaYDIFOnltLO1oh/Zl5duBabeF57pBt1LoQIbUBIxwt9tC6Fq8oo2MzMh0esVbHJJFCwmClZ8lUjaRBZSI/IoYT5CU+46g1O4XgEs6RQ4QyuCsQ/2y78gtmHP6x+nifGDpQ+VVUFuH23v64X1ODGbJGv+4+DKZufEZBiSWbHTS+8lMCIBX6bvmzAvkMNQFOZHgtu4yO63Bx7oiA0HAUg1cUoMeI/BFrfTA7bezABMRilvH5w5BOENRTzIzagsVNA0tB4Nbj91WcHWI+aMWXa0UUQTk22OcRZbo8b3fLi0OImJdvEOs0F61Q3EfztWT3m51ApwG2yXXx+rnBzsv9ajySmZMoUni4k6eFHmXD6g29z2d1DGdUrPhT2gM3HfvkPPwQNaHK/6ap6L7cLqV0rK54H8kyuAvBZb7x7Yj8q4oSynnKV08dqyLSqtoSPJVfuNKZ6C9S78YNHn0tLsOgNkxVRvp8x6ILgugQgWELZ+jpQwLAY7gEzk+ohGRsPQY= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(186003)(52536014)(66946007)(26005)(4326008)(76116006)(71200400001)(66556008)(66446008)(66476007)(64756008)(44832011)(9686003)(508600001)(7696005)(86362001)(5660300002)(110136005)(2906002)(33656002)(38070700005)(8676002)(38100700002)(6506007)(8936002)(55016003)(122000001)(316002)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lZkJtyQ8+g/DqEveP5LcOldpW3iuQZIA7cnRVXnDSiv2i1ZXde3TU6ejL/x6?= =?us-ascii?Q?l9bTSNUngtcMyajuWFqYOl1ygL2R3xdevsebdczV2oOpz2Obr19W2kzpOxjK?= =?us-ascii?Q?yoS1OB02o+EJtpYCu6PGhdbi5MgNrJ+GUfPMKIs2x8vDSGJOvSJ3glD9uqhm?= =?us-ascii?Q?dpWtLTGse0rJ526LbOVSgErxJfXH+mZRtstzeEjm6o70Dzl/stYHNm+vt7rp?= =?us-ascii?Q?fUTKK1ZVYesPhqXC3+DfejbZlf0ympT5y0v/rYyIss04DJAdNWDc1y+oFWLS?= =?us-ascii?Q?FCKBC0RauWTo3LtVQ5AxFY4J0OO4U8tRu96Nzi+bu19OeYKHZpePJIqkAr3S?= =?us-ascii?Q?YNxz2Yxpw6mpmKHpGULejObbw5hqQN/3x4zie6LhB784B/mvzfIUCc24fjJw?= =?us-ascii?Q?CzdjuGh6LKUhAcPS/tQvCdayaoBj/adiMnNnfGHoQDLIPPTMsrYW6fG8kR74?= =?us-ascii?Q?REJfAYrL39/2URhh1X1PAYHdorpTV4jsCqCTL3QeCG32Zd/BttHxjmByQrb5?= =?us-ascii?Q?wzuOYeCiksLHRHPM8rAFr0FVzgPPvzLWJHAVA684EhnSveylJ1+QhYAkvTDB?= =?us-ascii?Q?+BdCe0Vuj1MEWlJusA1nxbwF/xotdN732/mqYNamds0QqiDi2lbyZdDqZ1ci?= =?us-ascii?Q?K5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10cf645f-b4d5-4f54-bfd9-08d9ce43c77b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2022 23:01:15.3761 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XBX/JMZ1OywpaLJ5/93enJ+FEToaDApg4xmI9r1Ws6XJn1w5UtHSUUNUFsZnjo19NawszVRryjTbNwXPKizvaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10215 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201020167 X-Proofpoint-ORIG-GUID: zMFFg0qu_prRAa1QeHCqvdnY8NrTK1kc X-Proofpoint-GUID: zMFFg0qu_prRAa1QeHCqvdnY8NrTK1kc Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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" Xref: news.gmane.io gmane.emacs.devel:283977 Archived-At: > > (static-if (assoc 'lexical-binding (buffer-local-variables)) > > (provide 'lexical-binding)) > > instead of doing `boundp' test. >=20 > I think it should be runtime, because transferring > compiled code between Emacs 23 and more recent > versions is relatively common IME. My question is about taking advantage of Emacs support for variable `lexical-binding' when it's available (which means for Emacs 24+), while still keeping compatibility for older Emacs versions. > >> [The doc just tells you how to convert code to > >> use lexical binding. I see nothing about how > >> to code compatibly for old and new Emacs.] >=20 > +1, there should at least be a paragraph or two > in the Lisp reference manual about that. I suspect that this was left out or neglected (un oublie) due to not thinking of developers of 3rd-party code that intends to work with multiple Emacs versions, including some with and some without `lexical-binding' support. I can only guess that such a use case just hasn't occurred to whoever coded variable `lexical-binding' in Emacs. > OTOH, I don't think there's much to be gained > by using lexical binding at all in code that's > supposed to be compatible with versions of Emacs > without lexical binding. >=20 > It's not that important. I fear you're maybe not getting it. Not all of the code in a given library needs to be usable in each Emacs version that the library is compatible with. And sure, even for that code that is to be usable both with and without lexical binding, there's generally no _need_ to use it. On the other hand, there's generally some advantage to using it. I mentioned as much in the simple example I gave - the drawback of returning a list with `lambda' car, instead of returning an actual anonymous function, is minor. I didn't ask whether I should try to have such compatibility in a library. I asked what the best way to do so is. I mentioned how I intend to do it, and asked for advice about that (alternative ways, a better way).