From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Attaching context info to an error Date: Fri, 29 Dec 2023 03:43:54 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40558"; 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 Fri Dec 29 04:45:07 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 1rJ3o3-000AKb-5R for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Dec 2023 04:45:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJ3nA-0006Jb-Il; Thu, 28 Dec 2023 22:44:12 -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 1rJ3n8-0006JE-JO for emacs-devel@gnu.org; Thu, 28 Dec 2023 22:44:10 -0500 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rJ3n7-0000z4-1B for emacs-devel@gnu.org; Thu, 28 Dec 2023 22:44:10 -0500 Original-Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2ccc6e509c8so31355921fa.0 for ; Thu, 28 Dec 2023 19:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703821447; x=1704426247; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=anK+bDjOcmZSi6U5wfUgqdyHse8kWZEfSwVCVkgZjiM=; b=Odx5pWJHIKRaRBgPFaUudtIvo30WXIbaV/RY0+rEqo9XrRoV/k0v5nvEwWe3S4ajYz LqOFKhyc8XOHKTEufjmWGoYvYipTY23C1Fh9kqIWlyxxh7VeoXT9TM/EDW5RfKKhQ9kW wwHIC+ABZ+zv13+wSap0RDZFEmk8zbhBJwCLh794oRToGUCpnfGvrdjtoGMlvKaaLRSG WjwN9t3b0v9pshRlWj2Lor+41gKepmim/fK6u77XVrGuBgLBLh2fWqPhPJGHsJAI5bpo jPs6NSsFj26YrAPTmAKTSDLQkL0ks4vqiOJdjEO4L6g8cRHHI4/u3k5zCHle+ooq2XBG wYiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703821447; x=1704426247; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=anK+bDjOcmZSi6U5wfUgqdyHse8kWZEfSwVCVkgZjiM=; b=AtPrAnAVEIEBps+Mvt08PsW7NilprXBMTKWexncqHF3Ekht6Wo5UeIxgpiLpSlTYRV h11uO/bl/beZ2nBf8XhnV/WuJv0rhmk7Qjrv1it3Yv94SxS1tT9UnFtHUASG30wqvHKt HKi2ZWo1JQ9Eo7jaPOTkvv3wCh+ZyzU7SqOj4gpQYufrBHfQ/HV4/7RKyEPenaZhf2jO 3kwsvpBZR4Jl/40YZQ/WbuzvpNxuN5fleTEYjeZcMLEHVc/EO/USg5dYWpKvFXqoyxtS SzIGDOE+LdrpDPLUQCj7AwL6PeSfdx6J0bAQp2G7GuF1k8a2027d0d7lfKQewk7MdlYA FkqQ== X-Gm-Message-State: AOJu0YywnxaHRiWaBLE66USTtmZb3nZDYaCRWxOMyDibhAr8qN8pkx+z uJKOuOAQcTfIGtezY+bP6wBqSPynIl2r05KrKVJebfnPf6o= X-Google-Smtp-Source: AGHT+IH9clJOqQkMul/nqfY0Zr4v4xDgtb9YvwmAqXlD3DEBzzbAlcoUXzj/iWXYf3+L60FBJ2beL4NFSKn4eg4dIYY= X-Received: by 2002:a2e:8004:0:b0:2cc:d4f3:aa3d with SMTP id j4-20020a2e8004000000b002ccd4f3aa3dmr2588631ljg.11.1703821446690; Thu, 28 Dec 2023 19:44:06 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=joaotavora@gmail.com; helo=mail-lj1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:314298 Archived-At: On Fri, Dec 29, 2023 at 2:55=E2=80=AFAM Stefan Monnier wrote: > > > What object exactly goes into the handler bind handlers? > > The same (even `eq`) as the one passed to the `condition-case` handler. Would it matter if it weren't? > > Is it the funny cons? > > Yup. That's ELisp's current notion of an "error object". > > > Can we at least get some generic functions to hide that representation > > so that we can change it later on? > > Patch very welcome, yes (and this is orthogonal to `handler-bind`). What operations are typically requested from it? - Printing? a cl-print-object would be sufficient, I think, along with a (orthogonal) directive to 'format' for using cl-prin1 (why doesn't cl-princ exist?) - Getting the type for resignalling purposes? Unfortunately, this returns 'cons' (condition-case err (error "bla") (error (type-of err))) Can it be made to return error? - Can we import a typep (similar to cl-typep) that understands basic types EIEIO and also error hierarchy? - simple-condition-format-control and simple-condition-format-arguments? - change manual to explain that resignalling is discouraged now that handler-bind exists, but if resignalling _is_ done, then definitely avoid car and cdr and some form of (signal (error-symbol err) (error-data err) introducing these new functions? - go through the hierarchy and add - accessors? Or do we already consider these details of "data" to to be hidden? If so, I think surely some violations exist, hopefully not many. They shouldn't be terribly hard to find. From some greps I estimate there less than 700 condition-case that actually use the variable and the majority seems to be resignalling or printing. The former will probably be fixed by handler-bind anyway, and printing is a generic operation already. I checked about 20 occurances randomly, and they all fell into this basket. This also tells me that switching to proper objects isn't that hard. Jo=C3=A3o