Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125377 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 CEE6D1A00BD for ; Sun, 1 Sep 2024 19:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725217693; bh=m5nxwCOwxNkHWs9C1B0tKFLSzheQcVMuEW+Ob4iKJqU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Q4pcryts5LHFOccaka3Glndt8YFDzbFPQKTIkkSuMwp2/lWSQ3XrDvjpWSee22QDP 6VcRwjMCAjd6U31CQAN6g8/IdnJmB2NhWJ3uC4QyCJgiEqRezOnSSaFN8X9rSZ3T9q PDOykYrP6EdyqZEDwC5sGB9UjeeKfgRrz+YTQJMRt4sw1YVd4AknK26Kqhe3z7ybNo foJBYXHHJjz9whi+F+aW3JWB9B+d5yP4ctxcl2JpYu9+Omh20UKqiK9uoHL/FJkvA6 zAYChIWIgIvShJEpHYh9r833K3w4zVqVKKa0L/H0SWb2edIyG83wug4J04c/jnxBkV aDhLMei1W3IAg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7A328180061 for ; Sun, 1 Sep 2024 19:08:12 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 ; Sun, 1 Sep 2024 19:08:11 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 28D0B114015F for ; Sun, 1 Sep 2024 15:06:15 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sun, 01 Sep 2024 15:06:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1725217575; x=1725303975; bh=m5nxwCOwxNkHWs9C1B0tKFLSzheQcVMuEW+Ob4iKJqU=; b= osc12l4N5j6RpAuUVYtNLq+iptj2BeYPozD5g5AnT5kPgUYRH7eftU73fHo01oPs nojpVKgbc/pHS84VPgfYAw0i45HpMzzFPaU2KWWPZSsgSG1grfMp4XsCn7un3Z5p GmgszsEuY1DIsL02v0BKTtGwuAIEEvUl9yUUiwttBlWAAxQLNftOAvbj98UnU0Vv fEjU4DzI7ZhtEmpDHFUaW5ZnexPQP7dBpmwzszBFlt02uv8+9iG7j650mM+HEJch Gc1GdUKuIehMZdtSl+nABhOxNqy/dpSy36z7Ss8iD2/u0FhgS67LIeSfipEFWgnL jhRZ4BDthnyVQfbtzWeX0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725217575; x= 1725303975; bh=m5nxwCOwxNkHWs9C1B0tKFLSzheQcVMuEW+Ob4iKJqU=; b=U Zg/l/GTvSNeiONKctow61EySSUcBJkg0daFvKhy427yXCdlyCFF+6ppz2erkEsYP 7T8efWjV07VD/3lJvvELD59mVfGMNXScnIDxWkSJHLEe9i9QZkDmv9DgqsS7JTle /9iNtzpJt9BGiaWa6rwD3tzrs3eZR0ZnWNVVlbUJwHqLqrnR6aCI7f0blOeGjKVw czXmI2zP4hoYJKQNKJzk50Yve2bTtSOmwMpfwPBwwFTp5+CqqGU/5GZRDOm5L/tz d+TkRLUzUMcr0DVzzAsqqQ6Ux1fIf76QeK+ySGhXzunfFt5HkIJ7M6Datr0bvMSg fLaqKojcrZeQSC604Q5YA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudegkedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf gfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhn shculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenuc ggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheeihfeh gfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohep uddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhish htshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 1 Sep 2024 15:06:14 -0400 (EDT) Date: Sun, 01 Sep 2024 20:06:12 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Re: [RFC] Default expression User-Agent: K-9 Mail for Android In-Reply-To: References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 1 September 2024 17:45:57 BST, Rob Landers wrote: >Is manually copying the default also not type-safe? Is php a type-safe la= nguage? I think a lot of the arguments I saw suggested that people don't re= view libraries and their implementations when upgrading or installing them= =2E This is just a shorthand for manually copy-pasting the default from oth= er code, and this argument really only makes sense to me if there are no re= views before upgrading/using a library=2E Copying and pasting the default value is no different from providing any o= ther explicit value; whether you choose 69 because you like the number, or = because you saw it was the current default, you are passing an integer=2E A= nd if you write 23*3, you're just writing the same integer a different way= =2E PHP guarantees the type safety of this under inheritance by enforcing cont= ravariance of input: if you try to write a subclass that would not accept a= n integer, when a parent class would, PHP will refuse to compile your subcl= ass=2E=20 Similarly, if the class provides a non-final method like `getDefaultFlags(= ): int` then it is type safe to call that and assume the value will always = be an integer, because PHP enforces covariance of output: a subclass may no= t return a value that would not have been allowed by the parent class=2E If you were designing a language where default values were explicitly avai= lable as outputs, you would need to make them covariant, which is option 2= =2E Obviously, the language cannot directly control the compatibility promises= of third party libraries, but these principles are well enough known that = I would expect popular projects to base their versioning / deprecation poli= cies on them=2E Regards, Rowan Tommins [IMSoP]