On Tue, 29 Jun 2021 at 18:15, Manuel Canga <p...@manuelcanga.dev> wrote:

> Hi, folks, here again with a new purpose:  ``` as alternative to Nowdoc
> syntax.
>
> Currently, Nowdoc syntax is very "verbose":
>
> $string =<<<'CODE'
> <div>
> <p>Link: <a href="%s">'%s'</a><p>
> </div>
> CODE;
>
> Why doesn't something like this?:
>
> $string =```
> <div>
> <p>Link: <a href="%s">'%s'</a><p>
> </div>
> ```;
>
> even as well:
>
> $string =```<div><p>Link: <a href="%s">'%s'</a><p></div>```;
>
>
> I see a caveat: this is very similar to `eval` syntax. However, this
> syntax is more similar to Markdown syntax.
>
> What do you think ?
>
> Regards
> Manuel Canga
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
I'm going to be harsh, but this proposal is utterly useless and harmful.
As already stated by other people this is just the same as single quotes,
and we frankly don't need yet another way of writing strings.
This doesn't even try to solve the issue with string interpolation that JS
does with backticks, which is an area in PHP which is quite a mess.

Now onto why this proposal is harmful:
This reuses syntax which has *very* different semantics (i.e. shell
execution) for something different,
moreso that the shell execution operator in PHP is valid markdown to go
into the same literal parsing mode as what the triple backtick do, just
inline.
Even if we deprecated the shell operator (RFC which got shutdown already) I
don't think it would be reasonable to reintroduce it without one full major
release cycle where it didn't have any effect/is a parse error.
This is also harmful for MarkDown because the whole point of the triple
backtick which kicks you into a literal parsing mode,
is so that you do not need to escape anything within this block, so your
suggestion to "just escape" goes against the very point of this syntax in
MarkDown,
which was probably chosen because it did not conflict with any programming
language whatsoever making it safe for this usage.

Ignoring the fact that this proposal is way past the cutoff date to be able
to make it into PHP 8.1 due to how the RFC process works,
it seems that this feature just came into your mind and you decided to send
it onto the list without considering its ramifications.
Userland contribution and opinions on new features (or other internal
discussion) is valuable but oughts to consider all the ramifications, good
and bad, and how it affects the language as a whole.
I say this because I didn't do this when I started contributing on this
list and it made for less than stellar discussions.
I would also recommend to any reader of this list who wants to propose a
new feature to do this at the start of a new release around September,
compared to moments before feature freeze where there are already a lot of
proposals flying around from many old-time core contributors.
The other benefit of doing this earlier than later is that you might even
be able to get someone to hand hold you to create a patch for the feature.

All this to say, this is a massive -1 from my end on this proposal.

Best regards,

George P. Banyard

Reply via email to