Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107504 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92655 invoked from network); 11 Oct 2019 15:32:59 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 11 Oct 2019 15:32:59 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 695E62D1FE9 for ; Fri, 11 Oct 2019 06:16:08 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Fri, 11 Oct 2019 06:16:07 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id l21so8660925edr.5 for ; Fri, 11 Oct 2019 06:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=VUaeyoowkdEA0lj9so228jKk4bDwTKqMDhf9hcGDkZI=; b=dPDVNHkx/l69tHwpgL6i+mkM1qSlVBuiKyKRo7otUx9cAf+GydVi/kgHdK5oRh08ZG UD2/0A70XCLfcB4a7wnIgMQmH5ejaX19TqYhUepe0coAjo4rIafq6rbLeMRnPdbaqWbc EaSpXwoQEAQAvoEdJp6q/nhLkEWDkdshiiRSRNNzLV5ADUqIVsQZ/ZqivSDgLNagZO8k HL52S5JkBKRWuugIPqDkgfigwxy2G0w5prE+bM9whAzglk54bxjtUXTal/kxu9EN3BLE nnw1J2z+Cb4EMCzGBRNm+rFtloJsBJlBVVhm+6t3miREkUY7T8aTC0z/R842P40kjtXr xjDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=VUaeyoowkdEA0lj9so228jKk4bDwTKqMDhf9hcGDkZI=; b=iE2zZ2001lIFNVgv2tkoCMhdv0F2r01dFxghWL0eYm2uQGFDfFgSDeGHMh4DUPMEOA zBvFRVZmUd6hz3r7b9jQM9QP8Qdz7BxgHD/K/rb+PEuPvW/y+DeLnR8JpzZkv0csk83g fVjOXZix9eNtfUAhKsic0FAcV6WF6zyEiBpm8xYqxJNZ+PBlZdcOBgDjuBOBuL5Uj1FD eJ7nPhheREMqsBTzCuCLbyfboiXH5k+5ym6fUFhJdShQ2us+M2EX61LSvIBndyHiFTVW eyfIjzMBXinYudqnA4XTCRRGxmqtZkgS8Xwzlj8UwxqoXzMOilPZ5wnKEkTIbmu30CWf PQRQ== X-Gm-Message-State: APjAAAVouheyY3iGXOAe6WQ4+MBKh+shkcuZMo+YPoW7tqAcv1AKUJ25 k3IQNp++c3MxmC7enOtedcQdK6PhJSg= X-Google-Smtp-Source: APXvYqxhFE68YaqM02+og6l9ZS5zTqfr4mFxOKiAabICv1KrRimzsnF+pLz/uWJZrigg4RJY5bNPFA== X-Received: by 2002:a05:6402:751:: with SMTP id p17mr13463366edy.161.1570799766444; Fri, 11 Oct 2019 06:16:06 -0700 (PDT) Received: from [192.168.0.63] (84-75-30-51.dclient.hispeed.ch. [84.75.30.51]) by smtp.gmail.com with ESMTPSA id f36sm1469332ede.28.2019.10.11.06.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Oct 2019 06:16:05 -0700 (PDT) Message-ID: <76F6996C-F254-47C3-AAD6-3338F38F30C6@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_7F272F9E-F37D-4829-9EFC-40D800E3BE64" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Fri, 11 Oct 2019 15:16:04 +0200 In-Reply-To: Cc: PHP internals To: Nikita Popov References: X-Mailer: Apple Mail (2.3445.104.11) X-Envelope-From: Subject: Re: [PHP-DEV] exit() via exception From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_7F272F9E-F37D-4829-9EFC-40D800E3BE64 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 11 oct. 2019 =C3=A0 13:05, Nikita Popov a = =C3=A9crit : >=20 > I'm mainly wondering how exactly we'd go about integrating this in the > existing exception hierarchy. Assuming that it is desirable to allow = people > to actually catch this exception, my first thought would be along = these > lines: >=20 > Throwable (convert to abstract class) > \-> Exception > \-> Error > \-> ExitThrowable >=20 > This does mean though that existing code using catch(Throwable) is = going to > catch exit()s as well. This can be avoided by introducing *yet = another* > super-class/interface above Throwable, which is something I'd rather = avoid. We should keep the semantics of `exit`, which is quite akin an early = `return` in a function. Therefore: * Executing finally blocks (as does an early `return`) would be an = improvement. * But intercepting it in a `catch` block or in an exception handler, is = usually unwanted, contrarily to everything that currently implements = `Throwable`. But if you do want to allow exit signals to be caught in catch blocks, = there is no absolute necessity to introduce yet another superclass or = superinterface, because you can write (since PHP 7.1):=20 catch (\Throwable | \ExitSignal $e) =E2=80=94Claude= --Apple-Mail=_7F272F9E-F37D-4829-9EFC-40D800E3BE64--