Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123669 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 91E381A009C for ; Tue, 18 Jun 2024 21:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718745141; bh=Y39QNv0fjl0/PkiiOgQreMEulvPfvjXoZjF9f2dDTRs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IIxdmdIMe5agTWowpNOKsQLDYWuQHLJLybnYVmc4i66Xxz3VY40VfetCyqVNsLj+P 9dU/HAwLjNsULIYSY51A+dt5dUC/7w3t5bjNxz9UR3asG+S2Mu8aUtlnTjj6pvJF5q qqwqpaH0WWZqrQeuQWtqXZ2guS8FKZL2LXoy+Q+9TXeorWPZxrkf0egLEIbnekiRcW DxmdQZdBIAMoS6fGW2TTO8vNdHSxMVA9T7OzaV25OS7XCUzeRjC9hjhZ6O67mfwvnn v45i71DJD/l3L/dPdJq8ezNxmMhplGLyZ/ICgcudqRXBm3BT+zC0Xh0eEkX7ssr2SW Qpzd+KfsA07cg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F17B61806AB for ; Tue, 18 Jun 2024 21:12:16 +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-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 ; Tue, 18 Jun 2024 21:12:16 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7955dc86cacso332839785a.0 for ; Tue, 18 Jun 2024 14:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718745063; x=1719349863; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Y39QNv0fjl0/PkiiOgQreMEulvPfvjXoZjF9f2dDTRs=; b=lIl3UdHVhw2FW4IWOlCcbZYg9263eHJupDvp6/FajUcpDhRHNeYUpSg6FRxlkw5eGT X6Utyx6dqktZHA+iJw8uoFGk7WwUNbkluqPSuqmidpWnaifxVgKpkktjbrL6Z87BBHwz HdafbAeL97YkmsIUrMRpx0TTbI/5aVAZzfkT/gHTxZEpBNvmtCbTxwC/xvnY4T2wN8qs LptXAGqm9ZPZUnD/4BISYF4ynzdjvDECmeKroTQCfqXNr8MCsj+CGT3SSCuUOvkjjdDI OCApfXNptT/pehod1lbPu1BvyMRj135+C3MZ5T69JSRRXkOSJ5zIEnkW5SQeI5wod1rP r4FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718745063; x=1719349863; h=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=Y39QNv0fjl0/PkiiOgQreMEulvPfvjXoZjF9f2dDTRs=; b=mg7NKk7Jo3CbSCMGkJROF/K1zxiCaZJhCJQXTnFBXuvh063UWOMZkGq70dythjEXu/ lqlwJHinc5L+LWGuFq13kYbVzpxE4b28MXDDiHbxe4wzkEcZbdfDT7/+vmh7J5QZEwql hNUp02Vyl8MuMuB2wN3zCSiJTs/uThx7gX//tXNRYPYEz54myG3QLSmtiu3r4i2esy0n KfUu+ksQpj20xJ5l1gT0KBC/tr5J9dHsmRgZv4mTQ1cWNN8BiNLuWcm5bzVfwg7wRPW7 ftZ/MNaZp9NIGtjwNv7MzUeOoKXVTdQUOQyQXy/uoh9N6O9TmWYJyhmf/UPMHKKVAR7D CMhg== X-Gm-Message-State: AOJu0YwMCGHHYZ1Y3OTe/VePNOjxDf5BzW/2QlU06gExxP47buUu3alm UYZMvUrpHXuep92ZT4PEViKz4aPopG09ho7x8bEsmIRCMwwqlMleUnzlrklTweqJAceDokpLyAY hLOoXhiUGDyTSqr+0hfIhaseJ4Vju7A== X-Google-Smtp-Source: AGHT+IE33dXrD0b2Hvek5vE3B2Dph5cRFkBTHzFk93/BjiRKSsxO9vDdQC8L2y7MWRnmayTPA84lhXSJO/5FqHTO2hc= X-Received: by 2002:a05:6870:80cb:b0:254:8666:34cd with SMTP id 586e51a60fabf-25c94984e23mr1137553fac.14.1718744674017; Tue, 18 Jun 2024 14:04:34 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 18 Jun 2024 22:04:21 +0100 Message-ID: Subject: Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion" To: Robert Landers Cc: internals Content-Type: multipart/alternative; boundary="000000000000c12a3a061b306d66" From: davidgebler@gmail.com (David Gebler) --000000000000c12a3a061b306d66 Content-Type: text/plain; charset="UTF-8" On Tue, 18 Jun 2024, 17:40 Robert Landers, wrote: > Hello internals, > > Many, many people start their files fairly religiously: > > > and I say "religiously" because from talking to people in real life, > reddit, workplaces, etc, very few php programmers actually know what > this does but do it nonetheless. > I think there's almost certainly a degree of truth, not just in PHP but programming in general, in the idea that there are many people who will blindly follow a convention for no better reason they once heard someone they considered more senior than themselves say the words "best practice" But I don't think the meaning of strict_types in PHP is unclear. It's right there in the manual https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict If anyone is daft enough to use a language feature without referencing what it means or what it does, let them clean up any problems which arise for them as a result. If I were to support any change to how this feature works for PHP 9, I think it would be providing a mechanism to enable it for all files at once, maybe either via a .ini setting such as strict_types_default=1 or a new declare which applies to all files included or autoloaded from that point on, i.e. a declare that could be used as the first line of an entrypoint script to make all files in a project have strict typing mode enabled/disabled (unless a particular file overrides for its own scope with its own declare). Changing the name to anything other than what it is now, with or without flipping the value, just seems like a major BC headache for no gain. -Dave > --000000000000c12a3a061b306d66 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 18 Jun 2024, 17:40 Robert Landers, <landers.r= obert@gmail.com> wrote:
Hell= o internals,

Many, many people start their files fairly religiously:

<?php declare(strict_types=3D1);

and I say "religiously" because from talking to people in real li= fe,
reddit, workplaces, etc, very few php programmers actually know what
this does but do it nonetheless.=C2=A0

I think there's almost certainly = a degree of truth, not just in PHP but programming in general, in the idea = that there are many people who will blindly follow a convention for no bett= er reason they once heard someone they considered more senior than themselv= es say the words "best practice"

But I don't think the meaning of strict_types in PHP= is unclear. It's right there in the manual=C2=A0https://www.php.net/manual/en/language.types.declarations.php#l= anguage.types.declarations.strict

If anyone is daft enough to use a language feature without re= ferencing what it means or what it does, let them clean up any problems whi= ch arise for them as a result.

If I were to support any change to how this feature works for PHP 9,= I think it would be providing a mechanism to enable it for all files at on= ce, maybe either via a .ini setting such as strict_types_default=3D1 or a n= ew declare which applies to all files included or autoloaded from that poin= t on, i.e. a declare that could be used as the first line of an entrypoint = script to make all files in a project have strict typing mode enabled/disab= led (unless a particular file overrides for its own scope with its own decl= are).

Changing the name = to anything other than what it is now, with or without flipping the value, = just seems like a major BC headache for no gain.
-Dave
--000000000000c12a3a061b306d66--