Re: [PHP-DEV] [RFC] Loosening heredoc/nowdoc scanner

[email protected] (Tjerk Meesters)
Newsgroups php.internals
Message-ID <[email protected]>
Hi Stas,

On 30 Aug, 2014, at 2:08 pm, Stas Malyshev <[email protected]> wrote:

> Hi!
> 
>> I would like to propose a few changes to our heredoc / nowdoc scanner to make it less awkward to use inside other constructs.
>> 
>> https://wiki.php.net/rfc/heredoc-scanner-loosening
>> 
>> Let me know your thoughts :)
> 
> With this proposal, you will not be able to use the delimiter inside the
> text at the beginning of the line, which is a BC break and may be a
> problem for some code.

Yes, that’s also mentioned in the RFC; although it would happen more easily when restrictions are completely removed, there’s a slim chance it would happen with the limited set of valid terminators. That said, I would like to quote from the RFC itself:

[…] it should be noted that the developer is in complete control of choosing the name for their enclosures; it's important to choose an enclosure that doesn't occur naturally inside the quotation.

> I'm not sure saving one variable assignment, at
> the expense of making scripts less readable and breaking BC, is really
> worth it. How often you need an array of heredocs or concatenate two
> heredocs?

There’s no real objective measure with which I can answer such questions :) 

The closest I could come to a rebuttal is if there’s no real need to make the syntax so restrictive, why not make it less restrictive?

> How often it is a good idea, readability-wise?
> 
> -- 
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.