Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124518 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 84E601A00B7 for ; Sat, 20 Jul 2024 16:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1721491589; bh=Yjo3rydGQ9IkH1kmss9Z9m2qZee7L00iaXlTpvSGqrg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=KYEyz2do1bBTysqlegxUAojT8c9+inEiFtaeZVqRDJHCC/M3pHdVOGdBoNty0C8hz l+2b7Bn9UC5kWQuDEZcfXLKywyt4kiEtT1WD5JwiyVcGv1sWs+CHXJex/VrKX2r0Lc voc6ptRl1PRRX5CM4a3noswCqoii1hkpK754tkfxi3YcnNlp+gljw6YnhsOTRKr1uT M4cT3IeVAfOxaI+3vRlFCwBd/TIjULYCPvMGwc8yAIKVEI3ZXY+yU3IXEss+bzC9Gv sztzpBWv8NdH8/tq1BIBjRexAnh3736Aouy1daorytEC1fOx0udYaqSBxFMQuzOdl2 LMAoAHySYP8qg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 37AED180076 for ; Sat, 20 Jul 2024 16:06:28 +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,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Sat, 20 Jul 2024 16:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1721491494; bh=DHXjxr54DNMpfSvvGVxrhmNdttC5HbsWkh4/0VSJ7es=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=igs9hmUgFBAOyGqriddYmXz9sTzFkUoSacJG6xd1HhaBYutgjGU0j7szTSvGCKret 3iZIDHdcHfS1tiarmfm1AI+bNnzN3WmUomr1/VMfCKQZV4unvyT9da39l06wWa88Kk WF+3bUtQX4c6JgbBCdV3mInA4vRoTr2Lu8kHvvG4uoUTySMhx+b0Qg4mvPFFvpp7TL MbSZuah5NbSfXVNRSZa9hdNFPNNYTbfquG8XuhCHtUbicuT2kcBPU6kynG2QlesQ9G 6VAYvTthGWhaSGpvolrL025MwCyqP8Ks3xLq6JylWjb3KywK2vruuswZWgg8hVzOBW g5JfwlrbMxiBA== Message-ID: Date: Sat, 20 Jul 2024 18:04:52 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] Request for opinions: bug vs feature - change intokenization of yield from To: Juliette Reinders Folmer , internals@lists.php.net References: <66984FD0.5090805@adviesenzo.nl> <6699F817.8070806@adviesenzo.nl> <9571bb82-9873-4319-9bd1-0361748335be@bastelstu.be> <669BDB00.70507@adviesenzo.nl> Content-Language: en-US In-Reply-To: <669BDB00.70507@adviesenzo.nl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 7/20/24 17:42, Juliette Reinders Folmer wrote: > I already mentioned cast tokens before. Whitespace is perfectly > acceptable within the parentheses of these. Comments are not: > https://3v4l.org/A6Sgj and https://3v4l.org/nE9H8 > > Now you may argue that cast tokens "feel like" a single operator, but > that's subjective and there's even a sniff to enforce no spacing within > cast parentheses as apparently people do pad them with spaces - and > doing so is allowed in PHP. * > _* Qualifier: spaces and tabs are allowed inside cast parentheses, but > new lines are not..._ I stand corrected. Though that indeed is another odd special case with not allowing newlines. Looking at the lexer, there's another case where tabs and spaces may appear, but not other whitespace. Between '<<<' and the delimiter of a heredoc. > So to get back to my original point, as of PHP 8.3 is the **only** token > which allows for a comment to be tokenized as part of the token. There > is no other token which allows that. PHP users have no idea what a token is internally. I'm looking at this from a PHP user perspective. It looks like two keywords, it walks like two keywords and it quacks like two keywords. I find it reasonable for users to consider this as two keywords and not care about how it's implemented internally. > So, what "feels" natural (whitespace-wise) to one person may not be the > same for the next, but comments _within_ tokens is different thing and > should in my opinion, not be allowed. As I've said: I agree that the current situation is unfortunate. But the correct solution is not "disallow comments", but "split the T_YIELD_FROM into T_YIELD T_WHITESPACE T_FROM_FOR_YIELD_FROM". Best regards Tim Düsterhus