From: Segher Boessenkool <segher@kernel.crashing.org>
To: Kautuk Consul <kconsul@linux.ibm.com>
Cc: aik@ozlabs.ru, Thomas Huth <thuth@redhat.com>,
slof@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Subject: Re: [SLOF] [PATCH v3] slof/fs/packages/disk-label.fs: improve checking for DOS boot partitions
Date: Thu, 28 Mar 2024 05:47:25 -0500 [thread overview]
Message-ID: <20240328104725.GJ19790@gate.crashing.org> (raw)
In-Reply-To: <ZgT0eCsT8SEiHV2Y@li-a450e7cc-27df-11b2-a85c-b5a9ac31e8ef.ibm.com>
On Thu, Mar 28, 2024 at 10:09:20AM +0530, Kautuk Consul wrote:
> On 2024-03-27 08:43:25, Segher Boessenkool wrote:
> > If an exception happens you can (should!) throw an exception. Which
> > you can then catch at a pretty high level.
> Ah, correct. Thanks for the suggestion! I think I will now try to throw
> an exception from read-sector if all the code-paths imply that a "catch"
> is in progress.
Don't try to detect something is trying to catch things. Just throw!
Always *something* will catch things (the outer interpreter, if nothing
else), anyway. In SLOF this is very explicit:
: quit
BEGIN
0 rdepth! \ clear nesting stack
[ \ switch to interpretation state
terminal \ all input and output not redirected
BEGIN
depth . [char] > emit space \ output prompt
refill WHILE
space
['] interpret catch \ that is all the default throw/catch
\ there is! no special casing needed
dup print-status \ "ok" or "aborted" or abort" string
REPEAT
AGAIN ;
The whole programming model is that you can blindly throw a fatal error
whenever one happens. You cannot deal with it anyway, it is fatal!
That is 98% or so of the exceptions you'll ever see. Very sometimes it
is used for non-local control flow. That has its place, but please
don't overuse that :-)
Segher
next prev parent reply other threads:[~2024-03-28 10:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 5:41 [PATCH v3] slof/fs/packages/disk-label.fs: improve checking for DOS boot partitions Kautuk Consul
2024-03-27 7:45 ` Thomas Huth
2024-03-27 7:49 ` Kautuk Consul
2024-03-27 13:43 ` [SLOF] " Segher Boessenkool
2024-03-28 4:39 ` Kautuk Consul
2024-03-28 10:47 ` Segher Boessenkool [this message]
2024-03-28 11:02 ` Kautuk Consul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328104725.GJ19790@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=aik@ozlabs.ru \
--cc=kconsul@linux.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=slof@lists.ozlabs.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.