Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123780 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 045781A009C for ; Mon, 24 Jun 2024 09:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719221588; bh=A1k/JFdpCqySDDL8uQvefEha6E/MGumcMlxW+RUZR8s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WF8bDuYBzop7lceKUENO6Lg6mRKKfPZo6U+J1tOOklaRB8BGkHvIadrQGgYkoNte+ 7z3c45Ppn70wJrQF0mVkSMpVThPSs7mCRO0Yn5s1t/I0/HENMkvU4J3ETgvbbkpxrP ovzQ3OM/NnwZLNU1Hh7PTeK/mM0952NQPpQIMTp52RG+902++xEpkC6K9p1TiJu6nr 9qyTCpi0URxI+RC4ypXrYLZm/tDNs7zOtf0d9ei24atA9JTtMyXU2gw0RB0FlfyHXg 84reyPnszc7rdP2oi6q9vLpRBFuBl1l8yTnQN/kfat/OSt0VdjkStyApLTrusSEXEU U5JQAHvIh3BDg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1BDAD180746 for ; Mon, 24 Jun 2024 09:33:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 24 Jun 2024 09:33:06 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52cd87277d8so2454062e87.2 for ; Mon, 24 Jun 2024 02:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719221509; x=1719826309; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A1k/JFdpCqySDDL8uQvefEha6E/MGumcMlxW+RUZR8s=; b=kf34/n4+vidh/edqo/EiAeSZESxPYMsoEgomNj98wMsXJn3TMKfFhu0OmabVstkcy2 MmY6kaA4Tr4IAtsbAj+MwuIza4m/xn5+LCQmKDOfKH+VOG9+h/DEA/5gWk0PR/OpXk1L BUHHiRNp1VSbZPFodwlwHkqyjjawc2cC31bJrHjhLCB5jMQwy/IRTNwyh+Dmno0zKb6W FUMLb/SPDMNZLXqtwRLgCOO4etDE3FvFQ1B9Z4AxBVMzn+yVQyK6edN0rlrxWpnF3wam K5+AEE37It4hJyqiuHozEIX3d4Ghq0TAYbbPXV7Y7MpLMaKa8LGYJxNhrnOH2YH7LMTO ximg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719221509; x=1719826309; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A1k/JFdpCqySDDL8uQvefEha6E/MGumcMlxW+RUZR8s=; b=Eog/fQEeAWARbLjDXy3VLeIutLUUD8At0EruCJ7W9GLWofSd4iPaj0tPTQ/thf0+6q kn8amAQ2Q92OfPYZjBw7welEw88G0tnppo0y11An2cg6eIcvTta/wJ44LoXZS/9r45No p/xzJS9zjJEPCZ9uhdOYn1NiOVsc7oo5fVgbkBd3TDeF9NYJevE3ktoN3rSnPqjGccbg cD00L1713HLI1Jitm7FhRidK0VVZSj4KdeIVm/908TcMHVtcosyRVNh+nK/QRIBJ/4Zi JRzuHph+iGF9jfwc1IKMphyIwboMcuy35EDxFdRx2FvGpOjCITtjYxDdqDMms3/qfCT6 DPDA== X-Gm-Message-State: AOJu0Yy8TExTWD2ORkQ2eRtGW/CsfYE1UeaU4BwRQ5cOV65p++9ccuQx /6dRlVZVKEpMM8F73rM6WFPri0fbJ1Wmaw0bv1HhnGUwivjUblOibNxmyAuswDXbTAh8rJVS27o Zrr1FmXdUgMuh3faoB5zUiWobhMb/96wM X-Google-Smtp-Source: AGHT+IG1ueqYmAIOo0SD9sDylwsaiLyAgiBShFuvLnaLWwid4wDWOmMUY0L1AiMDZimOdnYCJKifdAi7RxInQiWVnEU= X-Received: by 2002:a05:6512:348e:b0:52c:9808:ddc3 with SMTP id 2adb3069b0e04-52ce183511emr2124477e87.15.1719221508584; Mon, 24 Jun 2024 02:31:48 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> In-Reply-To: Date: Mon, 24 Jun 2024 11:31:36 +0200 Message-ID: Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching To: Hendra Gunawan Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: landers.robert@gmail.com (Robert Landers) On Mon, Jun 24, 2024 at 7:04=E2=80=AFAM Hendra Gunawan wrote: > > I agree that this proposal should be proposed as a whole. If we break > it down into smaller parts, there is a chance some features will not > pass. This is exactly my concern and I fear we will be dealing with the repercussions of a non-well-thought-out sub-feature for years to come. Why does `new Pattern()` have the ability to accept patterns as a parameter? Can other code do that as well? Why is @($thing) a thing? @ is already an operator so seeing it used like this is strange. Same with ~ . It's also weird to see `?` on the left hand side of a literal. PHP already has variable-variables, so use those instead of @(): $foo is $$mypattern. There's no need to use `?` to check for existence on a key, so this: $arr is ['a' =3D> string, ?'b' =3D> string, ...]; should be this: $arr is ['a' =3D> string, 'b' =3D> ?string, ...]; because $arr['non-existent-key'] is NULL. ~ has no meaning in mode 0, only in strict mode, but will force people in mode 0 to work like they are in strict mode or litter their code with ~'s. PHP is duck-typed and making it act like it isn't is just bad DX. Further, it isn't clear how it will affect literals since it is also bitwise-not.