Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105085 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1586 invoked from network); 4 Apr 2019 23:48:19 -0000 Received: from unknown (HELO mail-wr1-f43.google.com) (209.85.221.43) by pb1.pair.com with SMTP; 4 Apr 2019 23:48:19 -0000 Received: by mail-wr1-f43.google.com with SMTP id j9so5430865wrn.6 for ; Thu, 04 Apr 2019 13:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=w3+ano7ti7mClrx+z7Ghv1FRRp8cNv7HfG8bpV3GVtY=; b=LQw4Zz4U47TG92yfJHpQPyQZE8e7RnHdiZJW8tt53LBtDp+K9Zi/GI2IPqC2Wx4Xyl 2Gr1yQ0iF0c2LJwESvcLWeT9Z9Nx1BF22xeCVLl+QUg68QgYl/BG6Ua1bDk93MXbR1HV 4xcMJo3z5dyLLVRsoPaQyxnbIZVVQbz7MFSVDloZJkA8QW/n53a9aVOfEaOL78BmLJwx HguJWxXnKhpm/uLdkJjNOmxAhBZtmiaki7zbXClUmSNgauWfjWTCrKGYI7qaMo+/hS51 SrGHFRNQ3oopdgqXWDzcLhXBLxFH21uE5Lg7eUZ4lH83VdB3KDvdA9A40OKtvZdKeIow Jx2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=w3+ano7ti7mClrx+z7Ghv1FRRp8cNv7HfG8bpV3GVtY=; b=i1Ipq3BCPBw+ExvaUcssZvqu0Qu62BUEyK2sWb/6kZc9r8zSWX3wNEzyy0ZR+W4P1n L1zC4l3R1V8zEO6i+Al4ZB7BRPvJdDln9hnCSwXGHly0OlmEdFHZG3KEtvOwMyru9qDB NYjiXhWJiPwPvT4qfnzfkWoITsV4kYdqO1qbSKcqt8rRPYjrJRXn3/kHzcL0j/nhYVwu 8fOIAyHWWq41RTV4AtTy+1sFtnlFX2zu79SN9Z7gd0oc06GMaM8ptnoEe78220UsEqLt mFx3FGk62Mgfwv/mkU8gXNn7y9Fxmnfxq54iiBMHDuDyemsDvUWb5YCoxu3/S51rZwDa 3L4g== X-Gm-Message-State: APjAAAULdt2MrAV90dr2oi4/weAOKWxhHs6AWh8HBCAk9+IoqEOYPeir n2FYj7nNa3J5K7tNZq4506L/e0Kb X-Google-Smtp-Source: APXvYqzLRPuq/OYfVGNfI2/5TLSv0Y3CQ+Zx+ch/hIg/t3RnfnPgf6XYbIMQjd72/eT27cLpqRc04g== X-Received: by 2002:adf:ce8f:: with SMTP id r15mr5402930wrn.90.1554410642226; Thu, 04 Apr 2019 13:44:02 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id e9sm32365340wrp.35.2019.04.04.13.44.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 13:44:01 -0700 (PDT) To: internals@lists.php.net References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> Message-ID: <917cb7bc-4abc-4bae-1a5a-b2ba1777fa55@gmail.com> Date: Thu, 4 Apr 2019 21:43:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Question about adding !function_identifier From: rowan.collins@gmail.com (Rowan Collins) On 04/04/2019 16:17, Sara Golemon wrote: > I would say that any exception thrown in (1) should lead to an non-zero > exit since the program has violated an invariant assumption. The problem with enforcing an exception contract at runtime is surely how to avoid the cure being worse than the disease. The behaviour most consistent with the current language would be to throw an Error - this is what happens for other invariant violations like "null passed where an array was expected". But that doesn't really make any sense here: it would mean wrapping a meaningful exception in a generic UnexpectedExceptionError and then throwing it again, at code that's still not expecting it. An immediate fatal error would be more practical, but I'm not sure what benefit it would bring. If the calling code has no way of catching the exception, it will eventually blow through the stack and become a fatal error anyway; but if it would eventually reach a catch block, what value is added by making it fatal immediately instead? For instance: function foo(): type nothrow {    throw new SomethingException; // or, more likely, fail to catch one from a deeper call } function bar(): type throws ( SomethingException ) {    throw new SomethingException; } try {     foo();     bar(); } catch ( SomethingException $e ) {     log($e); } The program can clearly cope with a SomethingException and carry on; but because the author of foo() didn't fully test their code, it has no chance to and is killed outright instead. Regards, -- Rowan Collins [IMSoP]