Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123941 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 48EAC1A009C for ; Thu, 27 Jun 2024 14:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719500260; bh=FBs3qgBKVgWdUBogsqa8sGo9V89BjIFnisEyzd/lJNQ=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=gX5/llJPdmlZBEujF+9Fg2KZqCY7AkJCxYpMsjprEDfxpyd5Jh59EkQUStrjks8xO x3DdHTw9JdD9UfMRCVq7aYCLapoMTgZnxSX5cRgyzxHjZ4V6KQftf9Nt4Ghuutrcl/ HhS/O4YD0eT/oNi69slr7AFUtKqIN9YYjNGSDnpJF+6l4mfb5g11KCv4KRSdbc5Uwd UzRbNkzYNGJAisMpH+f1LUiwCINTSDsozlOYO9bnrxjYLxLp6yK5bjEkCIw/eXJw/6 9DiNhEI48Cs3q/vu2+1oAPqgcaSI3XJHJrIoUM69Gy9bRjEpKrlTU0Lqt9GjsE41G8 ZU/uwKioN8vqg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 93BB9180A9A for ; Thu, 27 Jun 2024 14:57:39 +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, HTML_MESSAGE,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-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 ; Thu, 27 Jun 2024 14:57:39 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52cd717ec07so7604508e87.0 for ; Thu, 27 Jun 2024 07:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719500179; x=1720104979; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=ePtDZi82mXuzSGgdPBRsfj4naqoUEhv4seC4Ww2Hy8M=; b=Ws07cB2y7yAMBU6XAG0iXjPe4WxRRgL1r8lOiT9QlDydSKI6n+xnuD0ymu2AkMNGQ6 EUY84fY902Lk8xBc2quBt9qouQfR9VFOUhxYjqVQb8JbJArFzKD5J213e7Qp+B4+qGv0 QGBcVTr6D5Ay1QCTNJkM5XJTSBeo/T3wEAvs30x9oUDKgX9T/8UyEjbd3Y3izrhcmtyZ I7tfoAxQZfrA6lM+yALutGNpCN5tWbDfMho/AbSPj6/Q7T9G5NJIw1alOFZa6rtu911D 1nDvmlg8vQBtZI1DtMSmNRsm31cnhu2xfQdT4TSVjlelCLMHCY5BfyCdt937k5qXe2qB 9zjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719500179; x=1720104979; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ePtDZi82mXuzSGgdPBRsfj4naqoUEhv4seC4Ww2Hy8M=; b=t6Tr5JOCPxCZ4KyDyy2ZrmE98RG+ARvDuCv3KCAip7CQxOK6uRTwMzXnqpTwZ0M5jh Luf9NYXv10SWfG7gwvFEmYtgZ8WkgWRwGAi/byBO1glzbs7HeSZYD8QQ9jyitDgSYSW2 JGypVPSA09UnOs/3kjcDN4Jzp667iDIwHio88PqR+ioTEcNVkr7vGbtg/otRuQwbDrRo 9D87Ju8E/kJEtUeOKhVFWmHQ38JM8sUbuwzsyUATfT04hHnaiSJ8W0ZsZ1IxE/nDnkJf NN5CLtlsyzS3vgVU1xJti4k8EpefLBTcrvuETOlY6yfr9/Bey/AJNzqLDx2KUCZpCPeq EK/Q== X-Gm-Message-State: AOJu0YwvqbTjWV/9MFatonQJhAMEvsl6VPFyDGaPmS6HUFZ3tdKKMNp7 hSRo8D/sxJLGdf0YBhEX9DGyiyZvPnG4c9Dvau5DgYJoVErsEj0Zm68DSQ== X-Google-Smtp-Source: AGHT+IEoer0UCII1adk8gip6Pu0UGoBk9RICtYnVeTexsHgLc8i9uGgSlWK3KCjjmxfTiBSQC9brPg== X-Received: by 2002:a05:6512:3ba9:b0:52c:df4d:bb9e with SMTP id 2adb3069b0e04-52ce183b7e5mr12730512e87.41.1719500179144; Thu, 27 Jun 2024 07:56:19 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a729d6fe68dsm67088666b.45.2024.06.27.07.56.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2024 07:56:18 -0700 (PDT) Message-ID: <678C8226-F47A-436A-994D-929B403881B8@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_DC5F0323-F362-4E3C-8219-E1977A6C0216" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [Initial Feedback] PHP User Modules - An Adaptation of ES6 from JavaScript Date: Thu, 27 Jun 2024 16:56:07 +0200 In-Reply-To: <1dfa55cb-5789-4090-aa10-f343fd8c4820@app.fastmail.com> Cc: internals@lists.php.net To: Rob Landers References: <1dfa55cb-5789-4090-aa10-f343fd8c4820@app.fastmail.com> X-Mailer: Apple Mail (2.3774.600.62) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_DC5F0323-F362-4E3C-8219-E1977A6C0216 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 27 juin 2024 =C3=A0 09:41, Rob Landers a =C3=A9cr= it : >=20 >>=20 >> PHP User Modules are php files that are brought into the runtime = through a new parser that is able to generate faster and more concise = runtime code by removing support for problematic features and imposing a = strict mode by default. They focus on PHP as a language and not as a = template engine. >=20 > FYI, in non-strict mode, this produces a deprecation warning that can = be caught and thrown from: >=20 > (fn(int $x) =3D> print($x))(123.456); // deprecation warning >=20 > but this will work >=20 > (fn(int $x) =3D> print($x))(123.000); // this is fine >=20 > Both of those are errors in strict types, so you might be tempted to = do >=20 > fn(int $x) =3D> print($x))((int)$some_var); >=20 > but $some_var might not actually be an integer-like (such as null or a = string that becomes zero). >=20 > Some of us prefer the more strict, non-strict mode as the built-in = strict mode is actually ... uhh, problematic, to say the least, in some = business cases. So forcing strict mode is probably a non-starter. >=20 Hi, There is no equivalent of =E2=80=9Cstrict mode=E2=80=9D in PHP. Do not = confuse it with =E2=80=9Cstrict_types=E2=80=9D, which has nothing in = common except the word =E2=80=9Cstrict=E2=80=9D in its name.. Strict mode in JS was introduced to disable design mistakes that = couldn=E2=80=99t be removed due to very strong (almost inflexible) BC = contraints. In PHP, we have deprecations followed by removals in next = major version. (And some people, including me, will argue: while JS strict mode = disables design mistakes, PHP strict_types mode *is* a design mistake.)=20= =E2=80=94Claude --Apple-Mail=_DC5F0323-F362-4E3C-8219-E1977A6C0216 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 27 juin 2024 =C3=A0 09:41, Rob Landers = <rob@bottled.codes> a =C3=A9crit :


PHP User = Modules are php files that are brought into the runtime through a new = parser that is able to generate faster and more concise runtime code by = removing support for problematic features and imposing a strict mode by = default. They focus on PHP as a language and not as a template = engine.

FYI, in non-strict mode, this produces a = deprecation warning that can be caught and thrown from:

(fn(int $x) = =3D> print($x))(123.456); // deprecation warning

but this will = work

(fn(int $x) =3D> print($x))(123.000); // this is = fine

Both of those are errors in strict types, so you might be tempted = to do

fn(int $x) =3D> print($x))((int)$some_var);

but $some_var = might not actually be an integer-like (such as null or a string that = becomes zero).

Some of us prefer the more strict, non-strict = mode as the built-in strict mode is actually ... uhh, problematic, to = say the least, in some business cases. So forcing strict mode is = probably a non-starter.



=
Hi,

There is no equivalent of = =E2=80=9Cstrict mode=E2=80=9D in PHP. Do not confuse it with = =E2=80=9Cstrict_types=E2=80=9D, which has nothing in common except the = word =E2=80=9Cstrict=E2=80=9D in its = name..

Strict mode in JS was introduced to = disable design mistakes that couldn=E2=80=99t be removed due to very = strong (almost inflexible) BC contraints. In PHP, we have deprecations = followed by removals in next major = version.

(And some people, including me, will = argue: while JS strict mode disables design mistakes, PHP strict_types = mode *is* a design = mistake.) 

=E2=80=94Claude

= --Apple-Mail=_DC5F0323-F362-4E3C-8219-E1977A6C0216--