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:21 +0000 Message-ID: References: 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="17783"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 03 00:03:20 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 1n49sl-0004Od-Ds for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Jan 2022 00:03:19 +0100 Original-Received: from localhost ([::1]:48900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n49sk-0007ll-GW for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 18:03:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n49qz-0005Yr-Ne for emacs-devel@gnu.org; Sun, 02 Jan 2022 18:01:29 -0500 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:24452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n49qx-00030D-2T for emacs-devel@gnu.org; Sun, 02 Jan 2022 18:01:28 -0500 Original-Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2029AgVh018061; Sun, 2 Jan 2022 23:01:25 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=J526E6+yBPflabiyrDA8WUYa8oRqTw2ljJtmZxdkDYw=; b=Ylb63iipc/PDWvem9q564RAZW1gwiCYqJF3heuNVKQ04kc+EAqC6YapYpyqeEBBsP3SJ LCOP4mwwkX4WQqze8IwrKEFVukHsUV2cBr5HuAjqEnsKC5Co3JwKHrKXiI6olIWhrx4g 0xKAeEV8PTGJtZHRyDw4blCUi80Nog4p4qCY/yzmedX0Ebw6P4JWyQK24wu3BjPejikp W4AioUoOTQOClezrE3UIQx6/RNz1oGWje6mHTyeiQ4rNDSmAPVn5Dpw2t9PCBz4ayUWF /B8XColrSisHy7BowCYgNOiZ4uqcipO6kG8ajEd3XGpezhVzABdvu+ENcXQ0SuHsQ7s9 bg== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3dafgu9mkn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jan 2022 23:01:25 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 202MpciN097392; Sun, 2 Jan 2022 23:01:24 GMT Original-Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by userp3030.oracle.com with ESMTP id 3dac2tsj9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jan 2022 23:01:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GBNzcD5i7KriVGtEHCSJl0QcE2xmol05pXO3lyCT71SQ+zeONaGN22IFCJ3qgvEarhMaP7kITMaXZccHHq/0d9yf2ONMVVfQ/+c8V6xxIvSMGaEKirtzKu0IfHp9/wsKQWw40hgDko0eXPYUzIKalamUX0szhmiMktdokkEthSvA6xk7fcOtqeFijn8BWI5/EeexDAlAFvFgrBhCCgePXHEHjASZTMuonV6/4EAfMwh06kYOs0deXzRt/1WxBaBTT05Co3ORLWlb8J2XLQqFdY9pBYbM+s+SQvJw4NyWwGdUgYEG5QA7RM1FSAvfELhO42hUwPJwgPr9TSfvprJSEw== 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=J526E6+yBPflabiyrDA8WUYa8oRqTw2ljJtmZxdkDYw=; b=NYdpCt95Oe3yeeXquL8JXAXzoRiHOZsbyK+gbvxu6XyH5iyln8Mxc2ztJcpm9/pH+l6MqbuUAT65i0cfMhmZaXULQfNS0J3m5SfkPtT+xKyax5KjYLmy41W/9fFOGcDM4oxKTp5mpKOLvQMrUX3xF0vAAGvjbyWpKpSFGSlb3OhP7BeuVh+Ctvk9Vq3yvaPCso/UM95gnhbP2Ah8XVFrtg8Kt4eURyrtdmFQRDzebCLFYdPvIVmT4rXvjDE/L4zCK7h4PNBB5SdrcdQx+WIv6crti2VEVo6DgV9B6WSRTsay7kPxJ9ylHIw7atJj+5TXU5QDi5NZ25i5gsiJmzZ1EQ== 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=J526E6+yBPflabiyrDA8WUYa8oRqTw2ljJtmZxdkDYw=; b=mVb7AoKaUWUwylj3NgPzhT/UiXVMNgo6siN2GJU4JkQ65aDECNYe/A65XMxboX5febECFtpdmHIhoE6FcOJE3TSSP8IIJANRGA5BLEajoA9WOH19bFUtOMftZs9IIcVe0f/TeTtCYyFG60v/9Qd+8/RRjpZqf7pnbKGnJ0Xt+lw= 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:21 +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:21 +0000 Thread-Topic: [External] : Re: Conditional binding and testing of `lexical-binding' Thread-Index: AQHYACynl+jASylD90ONpWo26FqSWg== In-Reply-To: Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b3dbd62c-8869-4b1e-b164-08d9ce43cb2e x-ms-traffictypediagnostic: SJ0PR10MB4495:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lm2n/IL/K8ESxdob0EFvtE/Zuww3xwUSBL8jfHt4+uLqQnLfRY9GCxdeE4gZOCXvzESJ2g1uRL4A6JRDxFMDqzNHY2y+dKcxHgI/90ytpO8ybxfAFuu5Esb15ne8it0g9SmSlzdqCY7mZvq+wj0mj3M6R/y9fO7fhxcYb2Mdb7DMAEscj9sWxTnS7TBfQGOioTN+4aVLird2Txk+h+uxD0ttyEbEecqi1QUdNuyQNVHApRgD5/AbDjYQ3oZDrczeLZprH0EYiJC4niX4D4vzgFoj+Iq5A/3twkGYYapcSvhVFOjxnVNt6N8LJUJVrVbeHfTMC8yLFs5Yqq5ntbfq60VFkJQn3jIQrtTb3wEf+/c94knwNrUQ8neL6XyRWX/K+H0ei0WW/JErCSj0tvgEzSmqg6Xb7M4jlpeV8Ud2+qBagau/pP8YGz9qbds7NAq2zgNl+j8stTn/mLOfN0odlniKiY6r7x87jh8c6JVlqmE3hmdCu3vUUTitfqbMELjUxLvuRItJxVkZUy1GYeGmBl3O6UurA6Wj/h+R/Z4DAKZa0TuwesWhpaUr8qkp+OdqMAOsplwNBFuzpUYJLQPt+3Sj8qoK5VaEdQ69K28lv3kgVXgGnf/cy2twfOO6m10gA+pebIgWMYCKeSBNPM/JNf43pdICPQ6N8lIT0wXLPjWM9b7uikV9gsvVkKdfuVvCvEHtYqcdPJIeRoXtiYNoi9o0qeipnAdzlJ2FxuDdIrE= 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)(83380400001)(2906002)(33656002)(38070700005)(8676002)(38100700002)(6916009)(6506007)(296002)(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?yp9PFhazYqIounN+vJ9cCC4LrZEvkb/OkUt4HyKqzf092y6NxmP4hjde1XQJ?= =?us-ascii?Q?N2l90aTTGzck8ApjOZFw3hn6qjcU2D8bA3wnwjWdR4BJV7KuJuCPZzEoFCWs?= =?us-ascii?Q?ul+Az7dP3N34rpuDoq7T/HuzVZumvf36w6BzksTGxo0lJTpvBogyLe69o3sr?= =?us-ascii?Q?JNMh7UyHUfGjpkR/vjnZBOI+HQbRgUBUR+qhKzXPmnRj5B6EKQ1huh+fuZqG?= =?us-ascii?Q?YK231r20uw0CT5GT5ZwdiXHiteDVpHBthfu4yki/RIOU4AmSFUShWk2bmzxD?= =?us-ascii?Q?NgKQq4v60g4HYXIt1knOk5gARsZ0p63O4BK+OVgbAGsSikOFxF/r46obLz0k?= =?us-ascii?Q?1HnfzBxcHzOUXAhMa4Enjp8UiFAP9UTgR0VSdBUvrjZ5tWa/NNBpwSQY58oK?= =?us-ascii?Q?ZfvAPIwt9a3U/tdmPAMsgmWiz2LEIBQjR6A15xxWlYSIhEPJyqwHemWt3TUc?= =?us-ascii?Q?X6uGTCZm31QB2A1coxHPBbP6lY8MMFLTbX5WYecfV9nwarUEGFIEW4E1e4gM?= =?us-ascii?Q?nouXQ+ljhR3gSOA4qdb0C68Hmd/gJHtImFDJq/FPzYVx947eGmwVed/RJ1KR?= =?us-ascii?Q?i9ONa+YRUwvAt5wTYi3SyJXu2+qKoBYgvXHFmmSLH6qFNm/c+LNBdpm5FQAs?= =?us-ascii?Q?km 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: b3dbd62c-8869-4b1e-b164-08d9ce43cb2e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2022 23:01:21.5664 (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: lesBq43Y4gx82100HlibgHxYzSxDmO2jWz719/pcTMDjhefH7UQGi5MGYawOtwKH3wRzYdTz4J1AwkoL2eekww== 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 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201020166 X-Proofpoint-ORIG-GUID: 2tgVuzNpHyKuqaTHfr9Vhxc9CINcOdQB X-Proofpoint-GUID: 2tgVuzNpHyKuqaTHfr9Vhxc9CINcOdQB Received-SPF: pass client-ip=205.220.165.32; envelope-from=drew.adams@oracle.com; helo=mx0a-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_H3=0.001, RCVD_IN_MSPIKE_WL=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:283979 Archived-At: > > What's the best way, or a reasonable way,=20 > > of setting `lexical-binding' conditionally, >=20 > I don't know what you mean by that,=20 And yet I gave details to make it clear, as well as examples. Which part(s) didn't you understand? > nor why you think it's necessary for: If you didn't understand what "it" is, then how is it that you think it's not necessary for what follows? > > so a library can be used with both Emacs > > versions that support lexical binding > > and versions that don't support it? There you have it: setting it conditionally so it can be tested, to check whether the Emacs version being used supports lexical binding. > Adding the -*- lexical-binding:t -*- at the > beginning of the file does that Thanks for confirming that this is the best (the only?) way to do it. If you read my mail you'll see that I figured out, by experimenting, that it's _sufficient_ to do that, to be able to test even with old Emacs versions (which don't have variable `lexical-binding'). This isn't obvious (and it's undocumented, AFAICT). It wasn't clear, before experimenting, what that declaration would mean for Emacs 23 or earlier - which behavior: 1. It implicitly creates a defvar and sets the value to `t'. 2. It's ignored, so the variable is undefined (unbound). 3. Something else. Before experimenting, I was guessing #1. But it seems to be #2. Knowing this is important, for testing the=20 variable. As I said, the test I apparently need is this: (and (boundp 'lexical-binding) lexical-binding) [Emacs 22 has `bound-and-true-p', but older versions don't have it.] If it were #1 then this wouldn't help. The var would be `t' for all Emacs versions, even those for which that variable has no effect. Please consider documenting this in the manual. It _looks_ very much like the declaration sets var `lexical-binding' to t, regardless of the Emacs version. But it seems it does not. > (this is used by CC-mode, for example). I don't see that in cc-mode.el for the latest Emacs release (which is 27.2). Even if it'll be present for Emacs 28 or later (when released), that's no proof or even a hint that the given library is compatible with Emacs 23, 22,...