Re: [RFC] Alternative syntax for Nowdoc.

From: Date: Wed, 30 Jun 2021 11:11:59 +0000
Subject: Re: [RFC] Alternative syntax for Nowdoc.
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-115236@lists.php.net to get a copy of this message
Hi Manuel, If I am not wrong, is not your proposal similar to python's triple-quoted? It is confusing; don't do this. Instead, current syntax are sufficient. Second, (`) have special meaning in PHP. It is used to execute commands on a machine. Why do we have confusing syntax? Best Hamza Ahmad On 6/30/21, Manuel Canga <php@manuelcanga.dev> wrote: > ---- En mié, 30 jun 2021 11:03:32 +0200 Guilliam Xavier > <guilliam.xavier@gmail.com> escribió ---- > > Hi, > > Hi Guilliam > > > Maybe other syntax could be used, but I don't know which. In javascript > > > only a backtick is used: > > > > > > https://developers.google.com/web/updates/2015/01/ES6-Template-Strings > . > > > But in PHP this is used as eval. > > > > > > > Just a precision, because you keep referring to it as "eval", which > makes > > me "tick" (haha): $cmd (i.e. $cmd wrapped in a > > pair of backticks) is > the > > same as shell_exec($cmd), not eval($cmd). > > Yes, you're right. > > > (BTW, one of JS "template strings" main selling points is string > > substitution / variable interpolation, which is explicitly *not* wanted > > with nowdoc [VS heredoc].) > > Yes, I mean that in JS is used some similar (although as you say with > variables). > I would prefer to use this "feature" with nowdoc. Normally, strings with > variables are moved to views, while large literals (like queries) are added > inline. > > > As for the proposal, overall I agree with Rowan -- well, that would not > be > > exactly like single quotes (regarding [not] escaping them), but still > "yet > > another way" to write a nowdoc string literal. > > I see this purpose as a simplification of Nowdocs. Just like [] > with > array(). > > > PS: "amusingly", the code samples are hard to understand after rendered > on > > https://externals.io/message/115213 > > ups!, I'm sorry...but, look at: > https://externals.io/message/115213#115222 > Markdown is not broken here due to ``` of code. > > Regards, > Manuel Canga > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >

« previous php.internals (#115236) next »