Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Libraries using longjmp for error handling
Date: Tue, 03 Oct 2023 05:01:27 -0700
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <86o7hfdieg.fsf@linuxsc.com>
References: <65SQM.565977$9o89.411905@fx05.ams4> <871qejf62x.fsf@bsb.me.uk> <86y1gphiur.fsf@linuxsc.com> <877co9d8m2.fsf@bsb.me.uk> <86bkdlghqr.fsf@linuxsc.com> <8734ywbvek.fsf@bsb.me.uk> <86cyy0fee5.fsf@linuxsc.com> <87ttrbclcj.fsf@bsb.me.uk> <86r0mfdng1.fsf@linuxsc.com> <87il7qcsfz.fsf@bsb.me.uk> <86ediee28o.fsf@linuxsc.com> <874jjaced5.fsf@bsb.me.uk> <865y3pe5gc.fsf@linuxsc.com> <87o7hgbpmz.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="a7f15c7033ff7991d1a910385a293cab"; logging-data="3730258"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u2zAiCaaZ1NSY1oDFBkCeseHWE3plvFE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:/1VQ/SHigIdKOV3C0sh+JkgI1KA= sha1:m4nsTGalBN1UwV9vIlWjUVObRc0=
Xref: csiph.com comp.lang.c:177194
Ben Bacarisse writes:
> Tim Rentsch writes:
>
>> Ben Bacarisse writes:
[..setjmp()/longjmp() in other languages..]
>>> Ah, yes. I was thinking in a lazy language (Haskell) while
>>> looking at code in a strict one.
>>
>> Right. I was wondering if that might be the source of the
>> confusion. Now that the question has come up, I don't know what
>> it means to raise an exception in a language like Haskell where
>> lazy evaluation is always in force. Does Haskell have exceptions?
>
> Yes it does, but I have not really wrapped my head around them.
> They throw you into the IO monad.
I see. :) Thank you for the info.
It might be interesting to speculate what C would be like
if it were lazy rather than eager. Maybe a lazy C could
have the property that undefined behavior wouldn't happen
unless it became essential to producing an output. Hmmm..