Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124541 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 A114A1A00B7 for ; Sun, 21 Jul 2024 18:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1721586899; bh=I5mh5+x+pekdNi5B8SyFJL86DaH2qxStnOoMqIGXPe4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=WJPVfXpZJTuMiBnFXK2pb8bGF45cBZPrFgUV/dD/+KeIKCWKiJiGqDEgKNeZB55GW b2kIkxbRKj7Qki92bK2XovJoquUPACATtccuA5UpLbn0i4qpJ8OyYIx3ilCafLezqk 3T5fbd41CGCSynMlM6ZvmfGRd1Zn8nvH3SAF6RJpoCxVtohNHw9GbNzwd3lYPiYD8t CL/7nProseBT+4YtyVQOUQkaBxQQWr/D9f0kNRj75dFJQ340e4/EVMzPhh/Dgz9xSb xQuhsJB0nhxISJf4Lp7SB6s2VFOGlWdiOXujZMizoCCjNpilJYHJD/nReipR0hm11O y9fAv9WT6Jfqg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B5CB18005C for ; Sun, 21 Jul 2024 18:34:58 +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=2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from buffalo.tulip.relay.mailchannels.net (buffalo.tulip.relay.mailchannels.net [23.83.218.24]) (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, 21 Jul 2024 18:34:57 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0E0A97A2FF3 for ; Sun, 21 Jul 2024 18:33:24 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 07D9E7A3BF9 for ; Sun, 21 Jul 2024 18:33:22 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1721586803; a=rsa-sha256; cv=none; b=mjE8ml+mkDhDmQQW2RAnUHoCgCUxe2ncMJdztNlJTNpYugrCiWcXxit3j7ZSFLS+DfxG59 CGVPm6zpSxEisuzIaLgDMNBn73LYdTZrsf7rbG+035oM7XTuTgPZwqkLgDDOLNONX6avXm inwWasIRQC9Fcy18Stp/nPLKFhpGrv3cbj7SKC4UHo/p/ZDH8jmp0Fy5O9PRHLAc3tKDkF PbtWt8CxwGR7cf1y23tTu4a8w6iUUmv6xOQQ7frz/C7BOMmfI9HJgo6p4knGDUr/wmch9G 4dDTIsJxA5uBlkpznUBcm5A0O1yZlEFmubfGhYQKCP1lSH7X/UvGFz6+xdJVGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1721586803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=paJMrdgqRAh7kcQPY/coGZpEVOryFypc08V8+RtgUoc=; b=UEKt81sIUvmddxSHb7v4Bq57lTZMDA/BgVzQg8qYqELTMEbGa3mKwc8FfPDWqf61IK8ReL GWiWMxpmdIaU/vN5/83LkuxZ0uiwkT8WTgENwySNPP0zw7x6KZhE0t+rQd8YUxGXxPvaVA b8yQCr1irfpnABFnmaRV2plkiP3gT7Mo6QIKLmrV1dL3bhxE1N3EyyAFbexQ/QFRIu2rsc cLvxha6+3CWaizSY6PsuAwdYm+iEHh7DYofxXRQSaPwEfzj5eG6fn5eDvi/dKmDqhJ9xFa l/4FmxRkBf43lnscizmUdURj+5B0WhJ/6s7zPddcZo38m/w3ZIJKegHR31EhTw== ARC-Authentication-Results: i=1; rspamd-5d9c874f6d-h74vx; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Supply-Illegal: 6963fa1312a00d4c_1721586803566_1385761964 X-MC-Loop-Signature: 1721586803566:4236154889 X-MC-Ingress-Time: 1721586803565 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.104.180.92 (trex/7.0.2); Sun, 21 Jul 2024 18:33:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=paJMrdgqRAh7kcQPY/coGZpEVOryFypc08V8+RtgUoc=; b=R2SJQ7H1h5iZ+NnrxcuNb5bhI2 ZSSpWnVegcSIXQHKrXiainCALUZzwjtU1GbvHwqBUuMIoQSpA21femYa24CKoXXjGh1I6BxkIAiL7 7NbyIsAAKwSG/gzApEi1YguQBuuD7jf3t3jslUzorbn7VVYHLLQk5npmdSODDpATToBU=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.97.1) (envelope-from ) id 1sVbN3-0000000C81b-0wMq for internals@lists.php.net; Sun, 21 Jul 2024 20:33:21 +0200 X-ImunifyEmail-Filter-Info: UkNWRF9WSUFfU01UUF9BVVRIIFJDVkRfVExTX0FMTCBWRVJJ TE9DS19 DQiBSQ1ZEX0NPVU5UX09ORSBCQVlFU19IQU0gTUlNRV9VTktOT1dOIE FSQ19OQSBNSURfUkhTX01BVENIX0ZST00gSUVfVkxfUEJMX0FDQ09VT lRfMDUgTUlNRV9UUkFDRSBGUk9NX0VRX0VOVkZST00gRlJPTV9IQVNf RE4gVE9fRE5fTk9ORSBSQ1BUX0NPVU5UX09ORSBJRV9WTF9QQkxfQUN DT1VOVF8wMSBUT19NQVRDSF9FTlZSQ1BUX0FMTCBfRFJVR1NfTU1fRE lTQ09VTlQgQVNO X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: 0.33 X-ImunifyEmail-Filter-Version: 3.5.16/202407201230 Received: from [31.201.40.213] (port=51564 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.97.1) (envelope-from ) id 1sVbN3-0000000C81L-0UTY for internals@lists.php.net; Sun, 21 Jul 2024 20:33:21 +0200 Subject: Re: [PHP-DEV] Request for opinions: bug vs feature - change intokenization of yield from To: internals@lists.php.net References: <66984FD0.5090805@adviesenzo.nl> <6699F817.8070806@adviesenzo.nl> <9571bb82-9873-4319-9bd1-0361748335be@bastelstu.be> <669BDB00.70507@adviesenzo.nl> <669BE870.2050908@adviesenzo.nl> <86eef5d8-6ffc-45e0-8ed6-6201a414cfb7@bastelstu.be> <2C00EB00-0BA4-40F8-92A5-50B49A639AD6@rwec.co.uk> Message-ID: <669D5467.4090103@adviesenzo.nl> Date: Sun, 21 Jul 2024 20:33:11 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 In-Reply-To: <2C00EB00-0BA4-40F8-92A5-50B49A639AD6@rwec.co.uk> Content-Type: multipart/alternative; boundary="------------000400010406010907080308" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------000400010406010907080308 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 21-7-2024 17:11, Rowan Tommins [IMSoP] wrote: > Oddly, the crux of this debate seems to be less that all options have > major impact, and more that none of them do. If the implementation had > caused a serious security or performance regression, I don't think > we'd have any hesitation in backing it out if a better implementation > wasn't ready; or contrarily, if it had been a headline new feature, we > wouldn't even be considering that option. The crux - to me - is that it is an undocumented breaking change, which by definition is a bug. As I've said before, I'm not against changing the tokenization, what I'm speaking up about is that it was done in an inconsistent, semi-random and undocumented way. > As it is, an improved implementation *is* proposed: > https://github.com/php/php-src/pull/15041 Comparing this purely > against 8.2, it seems a reasonable compromise: consumers of the token > stream still need to make a change, but it's the slightly more > intuitive one of "treat yield and from as separate tokens, which might > have other tokens between". Personally, I think it's reasonable to > consider that a bug fix to the original change, and push it into 8.3. > > Projects using the token stream could detect the versions with the > imperfect implementation, and emit an error explaining the "bug" if a > T_YIELD_FROM token doesn't match /yield\s+from/ Projects parsing the > source code on their own will have to handle this however they handle > contexts where comments have always been allowed. I agree the improved tokenization proposed in the PR makes better sense. Having said that, it will make the breaking change much much larger as it now would no longer just be a change which can be handled in the PHPCS token stream, but one which will impact individual sniffs, what with the removal and introduction of new tokens. If that PR gets merged, it will mean that PHPCS will need to undo the PHP 8.3 and PHP 8.4 tokenization for the time being (in the 3.x major) and will only "polyfill" the new tokenization as of PHPCS 4.0. In practice, we would be moving the breaking change to PHPCS 4.0 version to not break sniffs. Smile, Juliette --------------000400010406010907080308 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 21-7-2024 17:11, Rowan Tommins [IMSoP] wrote:
Oddly, the crux of this debate seems to be less that all options have major impact, and more that none of them do. If the implementation had caused a serious security or performance regression, I don't think we'd have any hesitation in backing it out if a better implementation wasn't ready; or contrarily, if it had been a headline new feature, we wouldn't even be considering that option.

The crux - to me - is that it is an undocumented breaking change, which by definition is a bug.

As I've said before, I'm not against changing the tokenization, what I'm speaking up about is that it was done in an inconsistent, semi-random and undocumented way.

As it is, an improved implementation *is* proposed: https://github.com/php/php-src/pull/15041 Comparing this purely against 8.2, it seems a reasonable compromise: consumers of the token stream still need to make a change, but it's the slightly more intuitive one of "treat yield and from as separate tokens, which might have other tokens between". Personally, I think it's reasonable to consider that a bug fix to the original change, and push it into 8.3.

Projects using the token stream could detect the versions with the imperfect implementation, and emit an error explaining the "bug" if a T_YIELD_FROM token doesn't match /yield\s+from/ Projects parsing the source code on their own will have to handle this however they handle contexts where comments have always been allowed.

I agree the improved tokenization proposed in the PR makes better sense.

Having said that, it will make the breaking change much much larger as it now would no longer just be a change which can be handled in the PHPCS token stream, but one which will impact individual sniffs, what with the removal and introduction of new tokens.

If that PR gets merged, it will mean that PHPCS will need to undo the PHP 8.3 and PHP 8.4 tokenization for the time being (in the 3.x major) and will only "polyfill" the new tokenization as of PHPCS 4.0. In practice, we would be moving the breaking change to PHPCS  4.0 version to not break sniffs.

Smile,
Juliette

--------------000400010406010907080308--