Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107502 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84618 invoked from network); 11 Oct 2019 14:59:36 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 11 Oct 2019 14:59:36 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 386DE2D201E for ; Fri, 11 Oct 2019 05:42:45 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (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 05:42:44 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id u22so13582161qtq.13 for ; Fri, 11 Oct 2019 05:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9zKQtZc/ZNV5Bck7vBcULHUSvVY0QWwbXHUrYOFCX3M=; b=EvQc+cbLefDyyPB2+K1gpXf6QYYImMht3RhBihBv1j0bkr6zp6RWFLzbuEoHtB4zOb x+q7xICmlRo8nPrQq0Kuf7gHk+L6CCckJzIYlPPLiZHy2e6D0Tx73IRD/PXUseHPn9Sy NPxXFwYmMULH7Xfpgjvll10OS9nVYX2/lIIXECe7QTGESDanVuEAg/rDmZcDuMdOU/oJ XuIAZfty++yE2A27IX/yZ3QrWDTfUEFDK8niYo/pfufRCkOWE1e1pWMLi+pB8+DJlb8C xjgNjC4J9UWgnNLR46tO8upbfAveLjpTJp/IO/izxpisVcKF+TawvFIfpj9NCMyaOLhB 7+qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9zKQtZc/ZNV5Bck7vBcULHUSvVY0QWwbXHUrYOFCX3M=; b=kMHWbKfHbOSBzbAVVh+b5egHPz/kxgDfYreOBpw6J3ZmVWpiV+/do734up1VGILb62 rvwKp0+jCziVDTjLh4skm1DXuBCfo2XmFpG3lzI6jZ4IUUpFVoTTMQlZTPg+dvb53NKM B0v/0jaH2vzB9/WYw+/kIYrvFNzzwwcTQAFqs5z6eIOuK+TyYGfUytLBao5XHEhrlrwu FgG0VJJRA8ahWD2jZSVOYgAK23m1JBMcoqqf766YTFD0b4mr6PBKt0EmNm6OCuRy2D0/ PmnYXIDhWlFmHKO1NDaxKkbO9/6sZDYkMAEKM3iYviZ8bjAWETPcgRHRD2PmcOShRYnv WYxg== X-Gm-Message-State: APjAAAVGfvrJYTZcBGtnoGpWM9Ia4+J3GJPFNJSYOPANpQ3YR0A5G2o8 ZkcT/nBjtRHvoqVmcOJZ6qPvYzw/7Vo= X-Google-Smtp-Source: APXvYqzw65v3jhWTron/tfPADith7rrm/Ch/Tm7FWLCi5TVpDIzuVBIBsR079NsnYu9zcf1Jiq6AVg== X-Received: by 2002:ad4:51cc:: with SMTP id p12mr1478358qvq.243.1570797763792; Fri, 11 Oct 2019 05:42:43 -0700 (PDT) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com. [209.85.222.169]) by smtp.googlemail.com with ESMTPSA id t63sm4065228qkf.48.2019.10.11.05.42.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Oct 2019 05:42:42 -0700 (PDT) Received: by mail-qk1-f169.google.com with SMTP id q203so8735633qke.1 for ; Fri, 11 Oct 2019 05:42:41 -0700 (PDT) X-Received: by 2002:a37:a708:: with SMTP id q8mr15211283qke.494.1570797761612; Fri, 11 Oct 2019 05:42:41 -0700 (PDT) MIME-Version: 1.0 References: <5da07648.1c69fb81.b7663.6eb6SMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <5da07648.1c69fb81.b7663.6eb6SMTPIN_ADDED_MISSING@mx.google.com> Date: Fri, 11 Oct 2019 14:42:30 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Mark Randall Cc: PHP internals Content-Type: text/plain; charset="UTF-8" X-Envelope-From: Subject: Re: [PHP-DEV] Re: exit() via exception From: andreas@dqxtech.net (Andreas Hennings) What about a new keyword in addition to "catch"? (exact keyword would be up for discussion) try { } catchExit ($exit) { } Or, how far would we get if we do not make this catchable, and (perhaps) not run any "finally" block? Could this already solve some of the technical problems, without breaking existing expectations? On Fri, 11 Oct 2019 at 14:32, Mark Randall wrote: > > On 11/10/2019 12:05, Nikita Popov wrote: > > 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. > > If it is caught, could the exit() potentially be cancelled by not > re-throwing it? > > What about a hidden catch block that is inserted at compiler level? > > try { > exit(); > } > catch (\Throwable) { > ... > } > > Would become: > > try { > exit(); > } > catch (\ExitThrowable $ex) { > throw $ex; > } > catch (\Throwable) { > ... > } > > The hidden catch block would be overwritten with a user catch block if > one existed that caught \ExitThrowable, and it would be *required* to > re-throw it, otherwise it would be done automatically at the end of the > code segment or upon encountering a return etc. > > It's obscure though, it hides things, and I don't think I like it. > > Adding another level of throwable is fugly, but it's by far the most > initiative IMO. But take the initiative and prohibit it from being used > by itself so we don't end up in the same position a few years down the line. > > try { > > } > catch (\TopLevelThrowableForSureThisTime $ex) { > > } > > ^^ Compiler Error. > > Mark Randall > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >