Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123672 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 B6CD31ADB00 for ; Wed, 19 Jun 2024 08:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718785986; bh=N+JEsP19EsHfKX3XaBVMea3g8FF+/XZk8AOMAEIprtg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gp8/ze9EheyOjx/bSptzNoKH6Mqmf/YryZj/vpSHH3Hvfui0aHN4dWFh96f4DPXfc XanV0pTAN79QWnPnt90rKU06W9m2ICQJcPZVLgALkmRlhh11PTKs/VlnXpfuT/IYv0 rutBdSq0GuftLQj6hRQzC0njcBsP042ZlWuAPNqm6KUbvxxEbRFj+9qTKLweTgq6FL y5yHGQ8VP9lZ4fj2jIBGhxW/f998vnqCky5l24bRkvVMjdASELq1cN6G5g1BUbELYN /BQr942EU6rV5QAjhWt/vwBTNBWTR356K4Bl/sVfCiZPBn/dIaDQf63fvXafdtYF1S 7G4izMIlRu8Yw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 99C481801D4 for ; Wed, 19 Jun 2024 08:33:04 +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-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 ; Wed, 19 Jun 2024 08:33:02 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52c82101407so10511395e87.3 for ; Wed, 19 Jun 2024 01:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718785908; x=1719390708; 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=N+JEsP19EsHfKX3XaBVMea3g8FF+/XZk8AOMAEIprtg=; b=ET6YEu499x+TKhxGjrE86JMAnuQelB3C3MlMVhxbVxzMhTgSsceAa+fe8x3t2nZPgK 8TO5XfvKR7am5vUpfN9H0uBuzISVqwG36vfSuTHuiqy6phuTSaIMfYg4JHWkvwncPZy2 jsOknfjl4q+iWLsAr2LL2P8DBjkjNzNVcdkbPR+8VrjBaxYCUoFA3aaTimLvAaJsRsRu p4qi6cOE1PYVhj68DbS6zvGLrEEBEkUmV6JJb4cEMVnlNMiOWqrVWVPenxJyGrwprq06 XLhKu0+hl80FcqQ3WJNnN8Ft5sNz3RSYQMC8BHWss9Ne3nEamWrk+7uGVMn3uJqEF51E 5UyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718785908; x=1719390708; 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=N+JEsP19EsHfKX3XaBVMea3g8FF+/XZk8AOMAEIprtg=; b=LKZ2eES5ONDah0GcJctAsHzZJFWsjRSEpjzFE2O/bu4XPOTkT53llSGEZJb2GTqQYQ dWe8nX7mWj3DwA6ONbDRgSKUPBC9BD2YmL5AERkMvFut16LQbSe1s2kZUgs6dGP4DnEp IzBNKVqllwp+EIgskv5aU6+z3xULv6VsuA2kK4Ngy7Vj07fjzXaT2LL4fVK3064MQjDJ kVLtnfNtJj/flHKDp39OCCErJJLliHk9lglrNxefHTQyaDlkTqx/diT7MlLZI7HtIGeQ JHe84d0mFgROzMgtUHKUBoQvmQJILjyW7q35cB50YEX95+OHbRSr6YAbkP5/LGxkklUm uOqg== X-Gm-Message-State: AOJu0Yx51DFCtT4fSDBmN/AoAkAkq0En5rwIVd/LH+T1gf+vHYWoy+PP /bfTMsnOyBMC0TUoOlccsB5KoqGLOshayQ9HVg8lgaQlUMSEIOJxc8OOkZQvQRORzgfL0gkhcmv SGjvM2g0T08MHTb8MNlD6i6qLcO4IoiyE4c0= X-Google-Smtp-Source: AGHT+IHjhS23E7PV9QsemS3wyLIAYuxcT5XuOb0xtysar+HL5Kpv6aK9qYf+w2VEFcAQQSE5C8Ha7amBc2mjQ2PX2RY= X-Received: by 2002:a05:6512:3c97:b0:52c:a2e8:dc71 with SMTP id 2adb3069b0e04-52ccaa595eemr1733895e87.64.1718785907524; Wed, 19 Jun 2024 01:31:47 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 19 Jun 2024 10:31:35 +0200 Message-ID: Subject: Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion" To: David Gebler Cc: internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: landers.robert@gmail.com (Robert Landers) On Tue, Jun 18, 2024 at 11:04=E2=80=AFPM David Gebler wrote: > > On Tue, 18 Jun 2024, 17:40 Robert Landers, wro= te: >> >> 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 p= rogramming in general, in the idea that there are many people who will blin= dly follow a convention for no better reason they once heard someone they c= onsidered 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 rig= ht there in the manual https://www.php.net/manual/en/language.types.declara= tions.php#language.types.declarations.strict > > If anyone is daft enough to use a language feature without referencing wh= at it means or what it does, let them clean up any problems which arise for= them as a result. The problem isn't so much this, but in that it has become a dogma to "have working types" and trying to explain why they do or do not need/want it in the current context becomes a hopeless argument because you are attacking their world-view instead of having an academic argument. > > If I were to support any change to how this feature works for PHP 9, I th= ink it would be providing a mechanism to enable it for all files at once, m= aybe either via a .ini setting such as strict_types_default=3D1 or a new de= clare 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 scrip= t 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). I've explicitly written code without strict types because, in that context, I want coercion (mostly when dealing with env vars) surrounded by files with strict types enabled. Multiple steps would have to be taken to make this possible (i.e., requiring the setting on every file, whether off or on), negating the entire feature of having it set globally. There may be a path where this makes sense, but I don't think we can get there from here. > > 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 Robert Landers Software Engineer Utrecht NL