Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112908 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59359 invoked from network); 15 Jan 2021 22:04:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jan 2021 22:04:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F027118050B for ; Fri, 15 Jan 2021 13:43:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 15 Jan 2021 13:43:16 -0800 (PST) Received: by mail-wm1-f54.google.com with SMTP id e15so2425603wme.0 for ; Fri, 15 Jan 2021 13:43:16 -0800 (PST) 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=V0z8gof1PEFh10y453HcEcDoZLTD2QPrWQm6p5Im9UU=; b=CiuSrHrLAZ6jUykZMxktrNc/GMvcEc+JrrfXvv/V/Ql9Hw7wFFWUuHezbEzgoMWUGM X71VUEEd5zLSwsnRsZKTcg4fn1NzsPN3kR6NGsmyz7oD0NvkJhIaV3B46HJWexgqOOLi s2YTMAmNIYL0A/0wu/vGZcnjLGuedw8rrWE4GORC3ABp/W0KVplxIT/uAPqjDpn0jkZ/ No/ESSdbm8HXVXp8CWDeCz9RaQGeE/JJyC2naVZYdHAH778URmIj2RJn6zjbh6zK6rYe F0cYZwRycPov1Ho1HCMxMcpP/qvx3E5uduiaRHLuubBSaeyvrBaVKMHWUaZxcYt4b14s tKqg== 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=V0z8gof1PEFh10y453HcEcDoZLTD2QPrWQm6p5Im9UU=; b=U/WwWTgpJCG+Yo+r6QhED3BC/YrulR574evRKgSvLJAL4mkci6bmB04Qd5bjBDe61g F27JQLwUQ076lLWDfpzLRga6dPT+6IUiZb5tK40qCe6Tg1K4VY9y3Jd4Y3HIJvQnGSti 3ORqS+0thAZN+a6uUxi2wzRfb480oNaUHZx8z9txUUeUyjw6jtfhAIJ1mwxi2DJaJqJP 0UlN7JDMCl7ZMt6mEQKC+ijLOyk3E5mJnrfTHHDlpKZld2xBsJsnxnLfRffLoSeqqZDq 7gwE/WkVvTcco8v7IMxNWMQhNs73cbQqHCqnJOkMyiXduk+RmtwG+oFqQfrg/XDFTxb2 vRsQ== X-Gm-Message-State: AOAM532Fra+LiHxYRCCIveQZd3zmEfBq9jxdjb3aRKusouy9Epl33LbD +KffwRJkwq80v8KJgnT0NQJX/n/kdl8= X-Google-Smtp-Source: ABdhPJxOaHqFx2YtnmkvXS0eeEdRJyas9/XVstIdHeQqejeOy45v/54ntJoxaNU3VeiylQmAHpYKDQ== X-Received: by 2002:a1c:7c03:: with SMTP id x3mr10735232wmc.17.1610746994770; Fri, 15 Jan 2021 13:43:14 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id s19sm14527179wrf.72.2021.01.15.13.43.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 13:43:14 -0800 (PST) To: internals@lists.php.net References: <5ffb8246.1c69fb81.63c3c.0c30SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: Date: Fri, 15 Jan 2021 21:43:12 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <5ffb8246.1c69fb81.63c3c.0c30SMTPIN_ADDED_MISSING@mx.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] Re: "TryX" idom for Enumerations From: rowan.collins@gmail.com (Rowan Tommins) On 10/01/2021 22:40, Mark Randall wrote: > There is an alternative, of sorts. Something I tried investigating > when I first started looking into PHP-SRC, but lack the skill and > knowledge to implement myself. > > A shorthand try / catch of something like the form: > > ( ResultExpr, ...) Funnily enough, I just wrote an aide that a language could provide this in a discussion of indicating errors via throw vs return. [1] My contention being that exceptions make it easier to express "do these steps in order and abort the whole sequence on the first error", but harder to express "combine these results, but if this one errors substitute this value", because an exception always implies a jump in control flow. Larry makes a good point that the capture of a stack trace for exceptions makes them unnecessarily expensive in cases where you're immediately handling them, though. I don't know if there's a way around that, without re-designing exceptions completely. [1] https://softwareengineering.stackexchange.com/a/421004/96713 Regards, -- Rowan Tommins [IMSoP]