Re: Request for opinions: bug vs feature - change intokenization of yield from

From: Date: Sat, 20 Jul 2024 14:51:30 +0000
Subject: Re: Request for opinions: bug vs feature - change intokenization of yield from
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi

On 7/19/24 07:22, Juliette Reinders Folmer wrote:
More than anything, I find it concerning that this change sets a precedent for tokens to include comments. Just as an example: what does this mean for the PHP 8.0 nullsafe object operator ? Should we now suddenly allow that to be written as `? /*comment*/ ->` ? Or what about a cast token ? Should that be allowed to be `(string /*for reasons*/)` ?
The difference between yield from and ?-> is that the former looks and feels like it would be two separate keywords, because of the *required* whitespace between the yield and the from. The fact that a yield keyword actually exists also contributes to that. ?-> on the other hand looks and feels like a single operator, just like ++, !==, <=> and others. Except for yield from the rule where comments may be placed as far as I can tell is "comments may appear where whitespace may appear", which is easy enough to explain and understand. So it makes sense to allow for comments between yield and from, but I agree that ideally those would be emitted as separate tokens. Best regards Tim Düsterhus

Thread (32 messages)

« previous php.internals (#124514) next »