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: Emacs design and architecture. How about copy-on-write? Date: Fri, 22 Sep 2023 16:45:16 +0000 Message-ID: References: <0518f65b-1dd1-6923-8497-da4d3aeac631@gutov.dev> <87sf7fc7kd.fsf@dataswamp.org> <834jjuk68t.fsf@gnu.org> <87cyyhc7uu.fsf@dataswamp.org> <83ttrsg9nx.fsf@gnu.org> <83h6nrg4eg.fsf@gnu.org> <83v8c7elan.fsf@gnu.org> <877conk5ny.fsf@localhost> <83ttrreeu0.fsf@gnu.org> <87bkdzeas1.fsf@localhost> <83cyyfe5l8.fsf@gnu.org> <8734zbyu6o.fsf@dataswamp.org> <835y46e8o9.fsf@gnu.org> <87zg1ixvnc.fsf@dataswamp.org> <87il86nxts.fsf@localhost> <87o7hyx8h2.fsf@dataswamp.org> <87o7hx88ry.fsf@localhost> <87jzsidws8.fsf@dataswamp.org> 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="29301"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 22 18:46:25 2023 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 1qjjIP-0007Q7-7t for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Sep 2023 18:46:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjjHc-0006dI-S1; Fri, 22 Sep 2023 12:45:37 -0400 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 1qjjHW-0006aZ-KW for emacs-devel@gnu.org; Fri, 22 Sep 2023 12:45:30 -0400 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjjHU-0007Kk-9H for emacs-devel@gnu.org; Fri, 22 Sep 2023 12:45:30 -0400 Original-Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38MGOJVr004739; Fri, 22 Sep 2023 16:45:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=s6GgEsPaX+ol58fMHu18fF11sbzQMgETkEdzGnzhp7g=; b=0tdGok6sTfwRk5AcD0B1f8q4j0zosm4aYqb2fvor6fy8cVnoxy2ApRmZnGZn83Fpz/pn O073/LPdUsslbzHznPMr0JOS6fx/fKfgxUI1ZQHB2JZym4D968PfaHvgwCxK5On9CVNd jefC1TE0jG6Ffef3m9mnw9/418Y/ew0ZDZrskBx624c5u8bUJfVOUyxvlxzKS2PyAS5r MkmeZrHc7up+yW0kKbZWyHtM1haFeqW7FnXYFChFp13aU7Jhlotdwg/Vp+JKwgjAB0dZ rdCAhtHumKvPTbKz0gGir21iGzvI8mw3PJzMx+EbpsDHxhamYaQeYznn5N4lX/5nDmB2 zQ== Original-Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t8tt1j8hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Sep 2023 16:45:19 +0000 Original-Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38MFPGMx021410; Fri, 22 Sep 2023 16:45:18 GMT Original-Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3t92vxm7jt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Sep 2023 16:45:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4eWg/9dyXsmpxAAyAyGyIxRvwXWhP460NN8Y7raLf9PB/G5fo6kpoDXeziJuBct5FqGTLpxGqlBWYhE8NrI/+QeFYaIEw9qCNTNhM7XP3IwYeQIENg4tm8zlZbo2OPpDOFCO7Vol1eF1IjgW4mS6xM4VGEBm11gMKj8A6IqnmSSf9dH6dkWGMoNqQw6ztB2+359nfs1dViHVEk26wUtT6mPEWigl5ynAlEyRbegiYaCCMG0e7CSN2Y8nBnAuRfjtWs4PApHk/4K9/b3sqEqLibh4tn88AoG+iYRrnBKZoU5Mh/43guxmpvkRA1d31WqT2SYH01BjdhwFCyh4S6l6A== 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=s6GgEsPaX+ol58fMHu18fF11sbzQMgETkEdzGnzhp7g=; b=fEYWAeBn5yY1uF9vN2LpGDYDA9yciF1gL1bQFctpMQe9Y4imqTcTq0Xsj6DTRmWGg2PkGKj2sS8Clz+BlyteRUeC+b3UNKy9igcexbeASHcUaT97ffY1XUCeQtnw5C7eNP2Y5UsExqnsNiKoF7Arl1LzkBB/UkRMd9O1sv1zG2NXhB5aJBNC7MlP7Lx9D+j3CCA60bVnE6wMiYdMhveAf5Uad4cjHoftz/t8C5yptSXGMPsFW/gGZ1X/MA5vMqWpi41OPfCDWrsT8DLGG64N29wZAtYN3lRm2qprUXOhTXd2PLZX3/3JuOQU3oa+NA3KiFxJ0oSn+gKosWnKlp3cQg== 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=s6GgEsPaX+ol58fMHu18fF11sbzQMgETkEdzGnzhp7g=; b=LNxGxwkwG/vHZEl+d6u3BqFgwo4y47VKt8KXzgf6awp1D34tP5xLsRzTdPWfsaiXQ4yhfARZo2JqtpjnqtiuBhtQ3CkLFGwDneAsI/yjOcFeLnCLjK9jx934QgKkFE3IF2UYpaM8cF62B1h4pbpuL2I8iMP+EXNBx7OozGz4oEU= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by DS7PR10MB5262.namprd10.prod.outlook.com (2603:10b6:5:3ab::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.25; Fri, 22 Sep 2023 16:45:16 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::7c3b:c5a0:5222:69a4]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::7c3b:c5a0:5222:69a4%7]) with mapi id 15.20.6792.026; Fri, 22 Sep 2023 16:45:16 +0000 Thread-Topic: [External] : Re: Emacs design and architecture. How about copy-on-write? Thread-Index: AQHZ7W7fVYuhmDZd9E64aq1F5HKdhrAnBLYg In-Reply-To: <87jzsidws8.fsf@dataswamp.org> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|DS7PR10MB5262:EE_ x-ms-office365-filtering-correlation-id: c710f554-b6fd-4577-53ce-08dbbb8b4ccd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 00wpuPemOUotxsmM6qRPM6ADomO5vljyD0ZTS2TQfhDYNfjAgmoaoH9TFGp4i5ChM7DNc7j7paTu8h1BlRGgkJeAQkTka2nlLEHsjnaJGXKQuz4o28rAKJqAwjeizwJz2OT0S224pdz/PomPjsNLqxZkVlW1YAMDBsvnTh51ObifgVuOdbuRBoIt8vvtG6XdSM0k5GWeMDrh/1Z0s9cGo10TyVyK5r85LLWoU6SvGOh8OAGe0zY0gDHIWko1lKGknQltmy5iP9qVpnUcAcpkxmrzCh1es4GEOaRbFxym4odomwA1v8cU4t4yfWMOE12CVK0emXTJydr2VqmO8JBcyWRzkqUkRSKRFTgYbBVpqpv33Le02NGSIJAoM73PVbXcdVxhtm5AB6mzvYBFwOdZk7HTwiPlI1k/NjBTDpNZef4h+kQBTf4vILjrRYfR50Ncf3NEdcKwKsOasAP0fSblOPrUkoFA2PCEs8JS1ljgrE1yROh/BWBUZ7cuCtnmgtv9ubMO7f1mlsCNSpE5SIBqAThyZAal5/LSFbPJpKA0KPQq95x6HDTrA0zYhC5ceWVLFYAPJS0UhX5bcnCRs2FD5GBicbAybWshc0V2IBoW8DOT4YQySxnFtVWwdaD2j4jOlY+afvuXn8jbD0TrJ7IUfA== 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:(13230031)(136003)(39860400002)(346002)(376002)(396003)(366004)(451199024)(186009)(1800799009)(38100700002)(7696005)(6506007)(38070700005)(86362001)(33656002)(122000001)(55016003)(26005)(2906002)(478600001)(9686003)(71200400001)(966005)(83380400001)(8676002)(8936002)(52536014)(41300700001)(5660300002)(110136005)(66476007)(76116006)(44832011)(66446008)(316002)(66946007)(64756008)(66556008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?So2OjfFOil4HL8+90sjuxc46riqRQzvXt4rr1c967YgsZJb+aD0ogB5xZ3Kn?= =?us-ascii?Q?MRtrXu36pNrtOmXamU5IiammxSfFcrzYyFWMMU8FX1bNjZsoakojcIYlNUbh?= =?us-ascii?Q?cqhb+NybTYpvrBFYrbuppg64Yq1/gYgAce1jkFrr3550KTEZc/2i/7WAVTLD?= =?us-ascii?Q?sFHPPPZltKcwQjNizDg8R3VgM6rHCjiDbtEVObnWRd9ZhNH80fegbk+TnduF?= =?us-ascii?Q?lJ0ZdbDqDvQAEz7RXp7M+MV3uk0JkreI90AUfFA9pV1lPCLxXHR+Z5DXPkEA?= =?us-ascii?Q?5gdFfcm1KUH5IcLcaxUfHvx9qacCgtfy3GkeO3kBU6vh2uC0EG+w2wIujG1D?= =?us-ascii?Q?vRGa2oIzru6flTxShQrBMAl7/ahBLkF33O3bPz3zF7H5Byz99qmzGiMQXqfI?= =?us-ascii?Q?KZnsUcK5c5x8Uvs5Ga01ZL4HVkifn70I/d+b3SFlYzITTTKX4q7fsBh793NI?= =?us-ascii?Q?zkdwxfgsuLnycNs22B+GgLw60TxHf7PQKEGtvGAN/HvqxhK2BXnJfq7s3hFV?= =?us-ascii?Q?Bw8x20WZgLWEFEnWipEtc67MUWaVe7WHQhMINYb3HzvMxk3wIa82EXm3ETmp?= =?us-ascii?Q?1vgdY1IsAxSD0inacG+9u5vW9b5K7cHxpG4/RA8joMGy3Yvw02lraixJSLUK?= =?us-ascii?Q?bZ X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QRTQKxbM1yW37ksBtVqlkA9quAAc3dlXVfWbqbpGGkvxUP1conLmNZJoI0Vc5pU7gx8/xg+0HUNOQnBCNVwIRtp1AdXNVnPsyb6Z2KFgXxJptlnNsEOlG7n7OlhcxaEFuzSUkMR2ABJAvPSegO+Hy9NT/Q+sZ2VuEKUECJ+HfkLpcQtTAPVdo50FoIuEGp3EkDi19EiTWaRlc12hzWhQLP0ZBCHyJnTdaM0lMrNdKbIlVJoI5DIPAvlC0QJJUDZD/kxazS2vkJya64YBVPsBBVxR/dfRP6hIPppDAlggmwz9LDOEuEF+5W0F0RllZ3Bv2VTVCTjASfxPtmPShjqMqLMDFCYo2c0Qw+ShmiZrgOJeC3Y02ZNEalxUQoskQvI8wuP0ShIx8Zg40Idq9QvZew43G6XMAmljhymObk5bIIaH8sVyGKznew5OfgTUmc7vMUz3kQegt0nQ76sa+n4uOY2lWPqYHo3uQiANtpmc6xJFSLq9j7CCRk0V6JpkpKDnD6twA0w0q5Dn+AM0LnTY0s/JpnxPZ0VfuM3YMh35zDhOk+zX0f3GP5oA3IZajvCsxAa10dy1s8RdHfZgl+UrGdOIdzPiczl8gdYshs9ff83AC54foGxkKXKG3+nkZQkTKgMYDTa4XRRqJPkzlfLFPOdgKgUx9HPr5FoVUZ39DIJrmK+duxNaGxOzaaUssGdfYrYjnrJgUt6nyMIIRuJHrowSIzyIhMOupqLKImg5Tswo2u Pn0mPvyJX/ApDxzrDiM/tkJeVeRmovCwbxGNNTxg== 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: c710f554-b6fd-4577-53ce-08dbbb8b4ccd X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2023 16:45:16.5924 (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: wbFs7Ll9tai1s0cIiEl6xZ2+ahrZYFJ3FT988aCsbuPX1O0P1Wko3vT60Z74RTPxtTYJEh/UN+FvhXJtsBaN7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5262 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-22_14,2023-09-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309220144 X-Proofpoint-GUID: WCtN82eYqT3dZCVfl0rIrqLrUOeJ19ym X-Proofpoint-ORIG-GUID: WCtN82eYqT3dZCVfl0rIrqLrUOeJ19ym Received-SPF: pass client-ip=205.220.165.32; envelope-from=drew.adams@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URI_DOTEDU=1 autolearn=no 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:310982 Archived-At: (Caveat: Not really following this thread, and I'm no expert on concurrency etc.) > Global/dynamic/special > variables are the exception and not the norm - yes, as we hear > from the name "special" BTW :) - and yes, they will have to be > locked one by one and for as long as it takes for the > execution to proceed safely. I hate to say it, but one of the points (the only point?) of global/dynamic/special in Lisp is to be able to affect other code anywhere, including code that isn't yet written. https://www.gnu.org/software/emacs/emacs-paper.html#SEC17 There's no overall, top-level director that manages where dynamic bindings should have their effect and retain their values. That's the point: the bindings are dynamic. There's really no such thing as dynamic scope. https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node43.html#SECTION007000000= 00000000000 ... it is convenient to define dynamic scope to mean indefinite scope and dynamic extent. =20 Thus we speak of "special" variables as having dynamic scope, or being dynamically scoped, because they have indefinite scope and dynamic extent: a special variable can be referred to anywhere as long as its binding is currently in effect. The term ``dynamic scope'' is a misnomer. Nevertheless it is both traditional and useful. Dynamic bindings have _indefinite scope_: References may occur anywhere, in any program. Dynamic bindings have _dynamic extent_: References may occur at any time in the interval between establishment of the entity and the explicit disestablishment of the entity. As a rule, the entity is disestablished when execution of the establishing construct completes or is otherwise terminated. Therefore entities with dynamic extent obey a stack-like discipline, paralleling the nested executions of their establishing constructs. So if you want to control dynamic bindings wrt concurrency, you really need to implement some kind of _transactions_, which will create and terminate the bindings as needed/declared. Maybe an alternative could be to use a kind of optimistic concurrency, using, e.g., a kind of ETAG value (e.g., on special vars or sets of them). That might be sufficient for a single updating operation. But to be able to control multiple updates of multiple variables over a given duration, I think some kind of transactions will need to be implemented. You commit the series of updates for a given transaction only if other sessions haven't modified the same variables concurrently (as determined by ETAG values).