Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120450 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15770 invoked from network); 30 May 2023 08:54:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 May 2023 08:54:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 58AD0180083 for ; Tue, 30 May 2023 01:54:28 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 30 May 2023 01:54:27 -0700 (PDT) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-96f7bf3cf9eso820103366b.0 for ; Tue, 30 May 2023 01:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685436866; x=1688028866; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=XIi5Lpb5XbsSuxjkFe6gQT95ZfpCYeExbbVJcE6tTYQ=; b=FD2g4K9ttLA2JG716D5zAzTeQjoVeABzeqCOd1D2ExMZbaWYnbXDz/dzPlGGWDfpmS nt9p9pizIAQ7iUvUUV5UNbekXpwiNFKj3Yeq17xkzb+2DmsZQPb6OhCCjqI/nz2Zm8WD fE9zKyf3vkAD8jWKQWd5OtIJgDYbrUvl41vXEuXmjH99/W5ECLlhcACcQyM+Gx/fOPyE jdeK0v0s7rzEj7hHcEVYtH6FQFVj0HigwbK1nkpiw4QQ2GZHoF+RUJ6dNtO4/BJ7QDpk 5IrgHsd+1ev5LZboriEtIbCfJzMsV3UQJy5qAbfYowWlb2w5BVky+8OFiM7Ty2PGhCXS IDIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685436866; x=1688028866; 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=XIi5Lpb5XbsSuxjkFe6gQT95ZfpCYeExbbVJcE6tTYQ=; b=LKcEbk78OioSGoUo2/wDbUTBr7DCfSlmUx7hQOx1+XMVImbTBV7XPJoTeQE5Dtw8M3 OYIwUyR5oC1lPFetRd4XglwSZ3QinP8ktWbByQo5sydASi1rnNFH1gldOKbtP9Xvxvw/ YglH1xAwBISsrNHLFhck21riErQsNlVjnch/Oa+qFQ8h76gdfuuB7ZLq4pwDVs3cNk/f cS/AnvdIDmALnxo6MZCIStfoB4T3BJvA0Q1dpmiPmwdJSzhVu7tbBRJ+Tdvz1DphZW0j jsPkMb1qldq7MJ5ikgJyWgwaJhp2vR0iCe8+Xck48XHvvb8GpKNPxmlx5QJNLa/V5nOt d17g== X-Gm-Message-State: AC+VfDzFqgiXIX+0N/bycFGRvyD8poCORIxvVItpiO+Um8K8yTD/6hV3 cdBvlE8U2arrGG2xK2lwF5M= X-Google-Smtp-Source: ACHHUZ70sFCpcKbOY4VCbmScT543aP7zfo3zN07TTzXO3azrjutSGKEhHmmGhznG718wPDscKFi54w== X-Received: by 2002:a17:907:961e:b0:971:fa86:27e with SMTP id gb30-20020a170907961e00b00971fa86027emr1535065ejc.16.1685436866226; Tue, 30 May 2023 01:54:26 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id e15-20020a170906248f00b0094f3d700868sm7012564ejb.80.2023.05.30.01.54.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2023 01:54:25 -0700 (PDT) Message-ID: <71F586BF-E5AD-4FD2-B680-6E0EDCB4733D@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_81CEA6E1-C737-4127-A341-4F760F2DBC31" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Date: Tue, 30 May 2023 10:54:14 +0200 In-Reply-To: Cc: PHP Internals List To: =?utf-8?B?TcOhdMOpIEtvY3Npcw==?= References: <5798AD17-3FA6-48E5-83E9-B5773BE94598@gmail.com> X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_81CEA6E1-C737-4127-A341-4F760F2DBC31 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi M=C3=A1t=C3=A9, > Le 30 mai 2023 =C3=A0 01:41, M=C3=A1t=C3=A9 Kocsis = a =C3=A9crit : >=20 > Hi Claude, >=20 >> The replacement methods for IntlCalendar::set() (namely = IntlCalendar::setDate() and IntlCalendar::setDateTime()) must not have a = return type of `void`, but `true`, like the original method, for the two = following reasons: >>=20 >> 1. By changing the returned value, you are introducing an unnecessary = hazard when migrating code. >>=20 >> 2. Per https://www.php.net/IntlCalendar, all modification methods of = that class (clear(), roll(), setTime(), etc.) consistently return `true` = on success and `false` on failure, even when the method is infallible = (and thus would always return `true`). Don=E2=80=99t break consistency. >=20 > 1. I don't see much risk with this change, since we clearly indicate = at the very beginning that the new methods return void, so programmers = migrating their code > should pay attention to the return types. IDEs and static analysers = can surely warn them in case of inattention. The very risk is that the programmer must be aware that the return = convention has changed. Recall that not everyone run static analysers, = especially for such a trivial migration, and that not every code is = statically analysable (e.g.. `$foo->$bar()`). Of course, the benefice of the change might be worth the risk; but that = leads to the second point: >=20 > 2. Some of the methods you mentioned have a "true" return type for a = few weeks now. The biggest motivation for introducing these was to at = least have some chance to > make them void in the future. Doing so is a risky move indeed, so = should be carried out very carefully, if it's possible at all... That's = why I consider it beneficial to spare the > effort and start with a clean slate by adding the new methods in = question with their correct return type. Concretely, if you change the return value (from `true` to `void/null`), = you will break the following pattern: setBar(...)) { // error handling (might be dead code, it doesn=E2=80=99t matter) } ?> Any change that introduce a BC break or a migration burden must be = justified. (There has been enough rant around justified BC breaks, so = let=E2=80=99s not introduce unjustified ones.) What is the purpose of changing the return convention of IntlCalendar = methods, and is it worth? =E2=80=94Claude --Apple-Mail=_81CEA6E1-C737-4127-A341-4F760F2DBC31--