Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112299 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52652 invoked from network); 26 Nov 2020 17:13:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Nov 2020 17:13:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A4CC1804C6 for ; Thu, 26 Nov 2020 08:39:43 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (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 ; Thu, 26 Nov 2020 08:39:43 -0800 (PST) Received: by mail-oo1-f47.google.com with SMTP id h10so515860ooi.10 for ; Thu, 26 Nov 2020 08:39:43 -0800 (PST) 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=BdUwuWG+Y7TcrqQQbhnEpRmOu1hZhQwXBvOXpmcR1G0=; b=Xgf4UYq3MAy0kNcLc3anCfl1pFnazz/qBdFosOI63vhmw+jLuxxPG3NmrzHjconFhx mbf7ldb4DW52UgjZItnAOCqDuFt6Pc6wHru+gNN6P7bfHG3jBOnMHQBY70rbLwHXgVJo Tq44ius7p3asZ9kzPPQNI9qISYbepEfObZhVLj/2hmfORKHASCXXfNqGqIhWha09zQKM 8Dv0wtjpKkmT238sxnsmQ+Hf7NHIXZ/M1eguyPl7rogjoYlNYXliboruEBghfgk4fXFD kVQkoQKZfuIa4EtkZ7dQsmrO3dlWqiZhDTPS+agWeZMCLbhdJIPGm3Ydio7WPZH4e1fR oG5g== 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=BdUwuWG+Y7TcrqQQbhnEpRmOu1hZhQwXBvOXpmcR1G0=; b=K8e5ioMpjbg/SGkDUgOBnOTBTQaZ/KEJfXCxO0kQvdFFU4Pz9yKbkpEoycyexvw5oR 0tO6eV71wTUbK7nIYkzIw1SV/51IZGzE83RCZVIiE70dIa+JK5NAxcKY6TwCsTKiWzns tDVJ5IYXqXwnYHI/ngPWdaDe3dKPuApS9ydVLW+EJZ9WffLrPXomwlXMI7TsZipNWg6L cjq+EgZd/QYHnk35VLA6NSSFz19Lub5zbcjB3XunRC8pPLAPGVmoJRa5NHxnYDSbEad9 /ngkot35xZgrFMHSrUxZwmimhk3apHb6998udIHD4IKIJxVqjdgIP9VZnys/l0l/Oe1L Vufw== X-Gm-Message-State: AOAM530NUsbXozeGLXfw7llCQEql3dvPkz1wvntRxhjvLMjFuBG7Fpos 7qldteyhDufB9YsyrLMVLwNUarddZizkiwvC0bg9iQOjkTy29A== X-Google-Smtp-Source: ABdhPJyR/PgLsY7xUbkTMa1XEs8dGttuSnG4xjpRQE/qNyh6+cl2L1I6xE2yqk4P1nEC2y2Y2Yy7LR4oldD0xIkg2/o= X-Received: by 2002:a4a:e40b:: with SMTP id t11mr2552786oov.43.1606408781943; Thu, 26 Nov 2020 08:39:41 -0800 (PST) MIME-Version: 1.0 Date: Thu, 26 Nov 2020 13:39:28 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000cfd75c05b505308f" Subject: Strict switch From: david.proweb@gmail.com (David Rodrigues) --000000000000cfd75c05b505308f Content-Type: text/plain; charset="UTF-8" Hello! With PHP 8 we have match(), that is a switch strict expression-like. But strict is not strict, and it could cause confusion because switch() and match() are pretty similar. I believe that this has already been discussed, but it would be interesting to re-evaluate the possibility of a strict() with support for strict. In order not to generate BC, my suggestion is to attach a specific keyword for this purpose, or a similar alternative. (0) switch(8.0) { case '8.0'; return 'no'; case 8.0: return 'yes'; } // no? (1) strict switch(8.0) { case '8.0'; return 'no'; case 8.0: return 'yes'; } // yes (2) switch strict(8.0) { ... } // yes (3a) switch(8.0, true) { ... } // yes (3b) switch(8.0, strict: true) { ... } // yes (named argument) Or then in the "case": (4) switch(8.0) { strict case 8.0: ... } // yes (5) switch(8.0) { case strict 8.0: ... } // yes Or allowing operators (this would be the most flexible way, as it would allow for a number of other features): (6) switch(8.0) { case === 8.0: ... } // yes Atenciosamente, David Rodrigues --000000000000cfd75c05b505308f--