Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105075 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14774 invoked from network); 4 Apr 2019 18:22:10 -0000 Received: from unknown (HELO mail-qt1-f194.google.com) (209.85.160.194) by pb1.pair.com with SMTP; 4 Apr 2019 18:22:10 -0000 Received: by mail-qt1-f194.google.com with SMTP id d13so3666035qth.5 for ; Thu, 04 Apr 2019 08:17:50 -0700 (PDT) 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=0jQ56sSgLD6i6KzX6gmHMCoduOKcAQD41+qm2gacNDE=; b=dczAgC7YXEZLEbt7tI+IYHTWua9+ZhtST9ey2SdyQguuc11f4OtebeQK17cDMXtK0F ARCVoDR+BEQQzwyXMPY6fSM8omdKtaQaNmmi5cSpY4znGvH30cKn5GehSI04N4a3tGhX HmEBnmL4m/LBEV70RCzLCMelS+8SFZxJqMAhLYtv0+dZ5TKMLMWc3/kSrkMVaeTBHSMV 7ZuvTUR+QJnzfSGuFyIBbKBN7MMUAfIcIJVq7JbmSCWRHH08AVDsn7PyTnJg9+vv12Zx yJiVovBqYjS9HZ0Nhano9qW1wUkXdnDhoqBTuMx0SRB/9SY2rISt5HOR4TrdNqF12V7h nh0Q== X-Gm-Message-State: APjAAAWLDV3g9T4j2SPxzbbjKIac8IVY9IyHq/Gdnz8wWshSa5lJPLWy jC5x4uFJwsRIUDFNX7bi63gqtgPXMMumCXCxURpQAg== X-Google-Smtp-Source: APXvYqyIWx1iGX3VUxd4L7Tu8/14SqW5yAkaotzHDDOJwHK9aOCT9sZQX2FMBuB+vgtTZcDrdrW0Jh1Gj9faEscrK1s= X-Received: by 2002:ac8:91b:: with SMTP id t27mr5754595qth.107.1554391069076; Thu, 04 Apr 2019 08:17:49 -0700 (PDT) MIME-Version: 1.0 References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> In-Reply-To: <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> Date: Thu, 4 Apr 2019 10:17:37 -0500 Message-ID: To: Stephen Reay Cc: "M. W. Moe" , "G. P. B." , PHP internals Content-Type: multipart/alternative; boundary="00000000000083c7800585b5dfe1" Subject: Re: [PHP-DEV] Question about adding !function_identifier From: pollita@php.net (Sara Golemon) --00000000000083c7800585b5dfe1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > Quite honestly knowing that a function =E2=80=9Cthrows=E2=80=9D but not > *what* it throws, is useless. > > Now if it were a proposal to add *runtime checked* > `throws FooException, BarTypeError` or similar, I could get behind. > Agreed. I use noexcept in C++ *because* it adds value. If this proposal were along the lines of the following (with runtime checking included), then I could get on board: 1) function foo(): type noexcept {...} and/or 2) function foo(): type throws(Type) {...} I don't even expect the runtime checks would hurt the happy path much since we already have a check for active exceptions during the function unwind, and once we know we have an exception, we're in the sad path and an extra millisecond to check the exception type isn't going to break the bank. I would say that any exception thrown in (1) should lead to an non-zero exit since the program has violated an invariant assumption. Similarly if an exception which is not of type "Type" in (2) should do the same. 2 should (arguably) allow for union typing the way catch does. (e.g. throws(Foo | Bar | Baz) Basically, the problem with this proposal IMO is that it doesn't go nearly far enough, and that a single character modifier is unhelpful compared to something actually readable. -Sara --00000000000083c7800585b5dfe1--