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: Better documentation for non-binding clauses of if-let and friends Date: Mon, 11 Nov 2024 21:21:39 +0000 Message-ID: References: <86msi69icp.fsf@fastmail.fm> 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="24953"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arthur miller , "emacs-devel@gnu.org" To: Joost Kremers , "Alfred M. Szmidt" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 11 22:23:27 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 1tAbsc-0006Kb-KB for ged-emacs-devel@m.gmane-mx.org; Mon, 11 Nov 2024 22:23:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAbrj-0006QS-2j; Mon, 11 Nov 2024 16:22:31 -0500 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 1tAbrh-0006QH-Cb for emacs-devel@gnu.org; Mon, 11 Nov 2024 16:22:29 -0500 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAbrf-0008Js-Df; Mon, 11 Nov 2024 16:22:29 -0500 Original-Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ABGU9bC026311; Mon, 11 Nov 2024 21:22:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=C0bORsgGljdP3hTcY1wRkha+8dFzniQJnKJQkPaa7j8=; b= mN1AVftZHOdoTyz5BuEFj/Gt3Ywm7wj0MsreKgw70H359Tk0rCb+CntD4z7eZMkO q/YmLrpRsqr+CJQ+awzIWooRDJZVG/wHOzK+szaT5TRW0qsIEQWP9Xy0wUQnE2PT OiD6p/+4ax2KMyvc2VWNtuXTPbotSqTG9WOqgeCykFMplJdJmagDSbcWNPD4Qwbv woEOgrQb2rTy0O+8RngVxqgIy+xIuFBaJ0ifv9R6/OwLYwFIqUqhQek76gdDGoLL EA+Nw9nR6slRGQ1Pak/8eQNVLrEQpZWoLS+DQqul7uTTu5tc1Mjbtx6S8xUZ5zGy RDE6/Jv9w+86/4PFO88q0A== Original-Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k5b6k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 21:22:23 +0000 (GMT) Original-Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4ABJNhKe022247; Mon, 11 Nov 2024 21:22:22 GMT Original-Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx676uxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 21:22:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VFjHmeA946OsZ5lDxiUEQiR12YC7SFVVVl8o+Xd2xFTvHLsW9sPrlC1S9VdM4ZEUxsOcM/QuC29ihx97gnvWGv/LgRZI/s4cH+npMl03/fNq4A459tZDk2Amhlo7vREg2jcqeF1I+hgs2wg3gAT5yTketxmev2Ezkzz/DrULQfin8U8nKCkqR8ZkGGTC02m4jGpJ/Vqo6g0KUTnMioK2jIvmuJVuDTy4wdHck2dUs3N3sT9isrSEYLHYUPNPLnVcNWsGaU+BdyeGrCyOso9Wh/2m7tl+elOsJNi3J1/c6tLSronlnBccBAhoCNaYN597WmOD9ppc8qLAt+DXVcTNhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=C0bORsgGljdP3hTcY1wRkha+8dFzniQJnKJQkPaa7j8=; b=L/GOx9jc1d3IAdleWRvtD+OME1phi7N199epiKQKV10/MzhNhchsOtIDxsMn/n2DBRZAaZDdUmUhgK/osnunRRPuCSJLFhyNkXF/YtJw4FIeRd112kOw1rgmwrJIQMzs/r+qoFfB8fBswKUawvznJFNFsDtTpS0DftNG/6Ooh2aFIa4K7nZVJYE1L1IDR9qITbY1/rAwYFhnNnJfC7zDBq6LJ8Q+5diqyW1NIu5MFxSRrKk6BCDmBJopioXs0v1wo8a2BmyE8IRXjc7SZidm1JN9OzrI5hxvLD5Z/hrTTRTw/k4WcGqCA4CLRMR7TC8msbiGiFbLS/wAeV+8XNTocQ== 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=C0bORsgGljdP3hTcY1wRkha+8dFzniQJnKJQkPaa7j8=; b=fxhoHvfi6xn4yZ32/YkButL9b6l5yKD4b6HR4TYXIt4svDth0l/jVeZm3U2QUtOXLF1h1SF1W4VKLiIuAWWvvSvwZcWeQG5jVWXdpv9XWeTIScJmWoICt6bBYzTsIyS9vnrhFJ0RLfpFv0SBjOCFInVtcoCPAfuHcKvtlQiZrz4= Original-Received: from BLAPR10MB5219.namprd10.prod.outlook.com (2603:10b6:208:321::22) by IA1PR10MB6025.namprd10.prod.outlook.com (2603:10b6:208:38b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.27; Mon, 11 Nov 2024 21:21:39 +0000 Original-Received: from BLAPR10MB5219.namprd10.prod.outlook.com ([fe80::8179:21ba:b158:7d50]) by BLAPR10MB5219.namprd10.prod.outlook.com ([fe80::8179:21ba:b158:7d50%6]) with mapi id 15.20.8137.027; Mon, 11 Nov 2024 21:21:39 +0000 Thread-Topic: [External] : Re: Better documentation for non-binding clauses of if-let and friends Thread-Index: AQHbNCRI51DVpN7oYEa77Ogfp0FXorKyjAtg In-Reply-To: <86msi69icp.fsf@fastmail.fm> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR10MB5219:EE_|IA1PR10MB6025:EE_ x-ms-office365-filtering-correlation-id: 5f9ccd5e-786b-413e-7fbc-08dd0296d4c0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?x0chSKHZ8Sy39DFEE0cZx58UjuL5GZ/tTdt+oi8ugT3FxRF9rFb2eipJo0yF?= =?us-ascii?Q?JgyUOMa1HpUMBVxrNxXKhz8qOutS2Jz7J7s8ADpGTMjZsvk0Q4IC0ozdqMO8?= =?us-ascii?Q?WJKe1NFkSxF7fpDQtvdFY8jKFEWj2BnlkQRqDkp7L6ncFVyZKTXJ+xEwNrSo?= =?us-ascii?Q?Ztld3268b7WGTUOaNmAvCO3dHa5GqHSl21BuhRpwz93dzf2fQEazEHW/52M/?= =?us-ascii?Q?wlSAemA5B52CF+SJrnEdOqf4rNy6GZZ3quGYUj/VARx/XhBNQpyhN5TVJ4GD?= =?us-ascii?Q?uzxrJPJey1Aza9iOVh2XyZARpl4DDSMLJADKQxvBEb20fFANUXbZTUdkLPj8?= =?us-ascii?Q?j4nA0WIJdk95C3Yu/qaknjoDpeX0YA8eVvLFw0FdwIYLZNrm7QqZuVWgeN6N?= =?us-ascii?Q?KeJOnbshezqy2bmbEQ51DEjhzLdy4XBHiUlUaH2QBdeTQBSJrpIUoS8h5Lbg?= =?us-ascii?Q?lYCtawggEYOxxlb6gbr+CXwp53WDFOAvaMn/OK3DFy6Ro9I6zzaFi0hAGzjU?= =?us-ascii?Q?lJ3bgqPlj8zjhvJz20itNvfun3ZQ9w2VGG9lchcW1m+eAY0GzarCeEEwkStt?= =?us-ascii?Q?YC6eWKKasTIv81St077H+O1Or77LmrNiaArwFPJp4gCVQ4AwqVPuF2YqwtSw?= =?us-ascii?Q?FduQE x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BLAPR10MB5219.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nhNmq/DCwzpv9OZA2i1i4uBLpoenQH/jkEdUlUHTcx0EmO3yQux5/YA1AoZQ?= =?us-ascii?Q?TF99fPYhLxlCtQikYAtiIJHFqsSQbQbiYKjkIf0UUfsDYoRY7+Z6Li15Xxxf?= =?us-ascii?Q?D0qtCK7TqwqYk5PSm5GEKo3e/B/N7yq2rMn5WvDU0ccrrYeEmvk2PJXpzw2j?= =?us-ascii?Q?785I+73YC38e7HrCPEa1tCdFf8/TqOyGsg7AZRkZzHiIUm1gwkrSd00l88Jf?= =?us-ascii?Q?1vJOVKiCFgdUTzwIZeGx23y/pUko7DRcI3lmv3hffFgxqllO+9ggOjHWm7cu?= =?us-ascii?Q?+s7vEBIn/ppSog+sab9ze0hGLvSXVowlABLurWOWb4AnWUsDqfh18WNRCyC4?= =?us-ascii?Q?Dey/GkYAT/+jutCdvDTQcRA9E7pH1q7waT0SmfPiMNJX0G8AGnPz4vneirAU?= =?us-ascii?Q?WtiNP7F9O3ItpuYZyoaP966r232XThDFtcai4pPpjF1eskzR164+qCVgMOkI?= =?us-ascii?Q?FI/l/eh8fricwqxDu/dvkOqpP6beERUOGxjLnciBBe3Nm6W8snAGz8+ia8E0?= =?us-ascii?Q?m/oFi8sffS3bp6tBIrGQihjd8K62zSjiwUEFtVlFgLxMr8hYxhe0mk6BBzPC?= =?us-ascii?Q?AzzZZWdvVHMna9zkc87IJ0CSd7SrI5uE+uBfnDNdQ/qPduEfgvbrPNfDLDwd?= =?us-ascii?Q?Xy X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CPHUhxReWG5dT6fSNuswFKcBDl6OWbfVcTxafntGBDCgE3td2U+pGSF6DdC/jQE1I6ZvUqhZMTEIaN0Wul4SCo2nWSyDyqJu0LTDT9bz3iPkm74/tGXtj3M8tXSVYSPWvryM5h/yiEmBcZxe5M1svAzgMHkXlSlhSbgO2BWjSkzS8zDk8IeMvdCJq/tP9z2//jrmN9RyvbVYlt4QyWVuREFvrQBZXXDZRacOn/GaY0wXLhdU315xo0zvFQaEmhWG+O/weal+KSfqvzL2b68hosXdH1yZ9yLA6cIyhnkstC5gePAvkX1eSRPOBF6R+j1nPMkg0474xvxDGBI0A37lGYUfIYCr9hr3joADbHrhtsOoA9+13LUpLYDs/fRIZOKfDGsnhREK62B6FKYA/NMW5XDXqSjKe83ZiqpjXkUU44okp8Nj+K3c5f5nqXV6V8IVozFlWcnhyOrIYc/QtgAX3QyDdLi3/lnT5+TvedLUDzVFlIMxkojHAWBWaeM+itOXeY98PZSNAG5r7t2GicIWjdlWVJSFeNu1qOPo8hlPcG7nw8/SdTgIZNeEw3/KHSs1t7PUmaYuKTpcoHmSYWFnv2BELKgvoR3fBOnkvDhYorA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5219.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f9ccd5e-786b-413e-7fbc-08dd0296d4c0 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2024 21:21:39.3926 (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: aM47KKxoKHTeYufGVNa4HviCfxVoosnik6vOp6woemqNYq44gqEIPkOzF9fX4LwQGc5wm4g+MmLAHMRiles46A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6025 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=805 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110171 X-Proofpoint-ORIG-GUID: 2rcRLdn0w6wnnxxVK2l75ZCbXAMAD2-V X-Proofpoint-GUID: 2rcRLdn0w6wnnxxVK2l75ZCbXAMAD2-V Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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:325412 Archived-At: > (if-let* (((parsebib--char "@")) > ((parsebib--keyword '("string"))) > (open (parsebib--char "{(")) > (definition (parsebib--assignment)) > ((parsebib--char (alist-get open '((?\{ . "}") (?\( . ")")))))) > definition > (signal 'parsebib-error > (list (format "Malformed @String definition at position %d,%d" > (line-number-at-pos) (current-column))))) ... > Not sure what the equivalent without `if-let*` would look like, TBH. Just `macroexpand' it, to see one equivalent, at least: (let* ((s (and t (parsebib--char "@")))=20 (s (and s (parsebib--keyword '("string")))) (open (and s (parsebib--char "{("))) (definition (and open (parsebib--assignment))) (s (and definition (parsebib--char (alist-get open '((123 . "}") (40 . ")"))))))) (if s=20 definition (signal 'parsebib-error (list (format "Malformed @String definition at position %d,%d"= =20 (line-number-at-pos) (current-column)))))) Or just this, if hand-coding (but you'd use a better name than `s'): (let*((open (and (parsebib--char "@") (parsebib--keyword '("string")) (parsebib--char "{("))) (definition (and open (parsebib--assignment))) (s (and definition (parsebib--char=20 (alist-get open '((123 . "}") (40 . ")"))))))) (if s=20 definition (signal 'parsebib-error (list (format "Malformed @String definition at position %d,%d"= =20 (line-number-at-pos) (current-column)))))) Did you really gain anything? Debatable. If you replace newline and multiple space runs with just a single space then you can compare the if-let* with the let* sexp above: if-let*: 335 chars let* : 369 chars (+ a few, with name other than `s') Beauty and clarity are in the eye of the beholder, of course. YMMV. But at least the plain let* doesn't require or invite a long discussion about what's really going on, as in this thread and its siblings.