Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113804 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46964 invoked from network); 26 Mar 2021 16:49:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Mar 2021 16:49:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4ECB41804B7 for ; Fri, 26 Mar 2021 09:46:04 -0700 (PDT) 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.6 required=5.0 tests=BAYES_50,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-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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, 26 Mar 2021 09:46:03 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id o10so8577507lfb.9 for ; Fri, 26 Mar 2021 09:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=sO5QQTEZb2BzRpU0WnvYvyEdBpjsAN4RRGdLI+cz+kA=; b=Ka5Dn/UABH3ekAkLjp0v7aZn4wqsuex3t4XtzOQIYTknStguIJUVv7DTJcbvSj30mx 0KC+6uD0o5slPI9qNDZHw1EZG6Cho21r1tt5uzatfjq5QHuSBoN4LYbUvKGUqohty6WW 5imW9OO1CM9YJXjck808ZQExysTwTB5BC8lRQup/dhJzr/DDSEMl3DgWDyIbU0OXC152 ouNYO91jMAsZIuVI1Dlea7RwueyJpwNeYJCxvzg5I2DPkuzMctJuOPiFpm9CFebnQGg/ 12Mizl8xa+kkhe4hm/ThFLgyGPC9zI2X0DATLMkf2oNjWtjBfLjoIMqHz1I++nU8a5gm Mhjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=sO5QQTEZb2BzRpU0WnvYvyEdBpjsAN4RRGdLI+cz+kA=; b=lK8QUacJHiJFvoKeb2thGxZoAiIGj1Xez3/wcnefuTR7QmtWInrk1lt0JSYu7P4r2F r32MnGWaCXJUMXRBA7GcdhvIyyX+msMLtFPrZyIZVfEViifmFfUlwY8yNN1gQJO22xAu qB6MWstba7x4Ubta2FtgvIp7XbQdKbz26w4NR/OjDosfqrUoGBvB2u0mpYeW1Iarr8/s 8drjSC1vaZubSMV/cd9UEvQqv1mXKBV7C96dqGhnyjAliHAbx11Gd2EA3GMUISj5nnb3 O/Q6Ci/v5Qq9tvJqN1THg9jbon9oxeqDxhVmtVCTukV1fww2oYjYmvjTJSE32JTqhhyi izqQ== X-Gm-Message-State: AOAM533LjJhJXDcIiVWT3IES7sZ6K/JhMcPQ4Sj/pFJ6TDXj2BhUFYkM Vlfq6VgH9kxD3r1ppneo26YgC5XTDI771D5NS2DWM26L X-Google-Smtp-Source: ABdhPJyx2rFjqTPp9W6utSTQ8SX2Y7V26bOPXLvqsoCmvL6IdwtFdotFJmGCKRaC0GOrntri4R9/EUaYkCL4moHilHM= X-Received: by 2002:ac2:4316:: with SMTP id l22mr8855624lfh.338.1616777159470; Fri, 26 Mar 2021 09:45:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:5f8f:0:0:0:0:0 with HTTP; Fri, 26 Mar 2021 09:45:58 -0700 (PDT) Date: Fri, 26 Mar 2021 17:45:58 +0100 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Making "match" catch exceptions From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) Hi, Someone mentioned that they prefer lambdas over try-catch blocks, which surprised me, since try-catch is completely idiomatic in both PHP and OCaml (Haskell I don't know). That made me think of a recent extension to OCaml which makes it possible to catch exceptions in a match-expressions (here's one blog post about it: https://blog.janestreet.com/pattern-matching-and-exception-handling-unite/). Now when PHP also has `match`, are there any plans to extend it with exception catching? So far I did not find anything about exceptions in the match RFC v2: https://wiki.php.net/rfc/match_expression_v2 Kind regards Olle