Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99843 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3883 invoked from network); 11 Jul 2017 19:36:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2017 19:36:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=ilija.tovilo@me.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ilija.tovilo@me.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain me.com designates 17.142.194.251 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.142.194.251 pv33p00im-asmtp002.me.com Received: from [17.142.194.251] ([17.142.194.251:40853] helo=pv33p00im-asmtp002.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/00-01782-8B825695 for ; Tue, 11 Jul 2017 15:36:24 -0400 Received: from process-dkim-sign-daemon.pv33p00im-asmtp002.me.com by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OSX00700WTT1700@pv33p00im-asmtp002.me.com> for internals@lists.php.net; Tue, 11 Jul 2017 19:36:09 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1499801769; bh=RGPfzlL0D0rhXqZ+syrLKGURQ2mKst+IMTe3Q6VQWzY=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=dzAqeQy7kXZTik/FS+0IkWj1xe+nD9RJ7TIFtybasGsmOFDrsKoVtWb7VjmVljEsV rlGg6cr2vqlBZypbvCI1V+71zwA0qSTt6/VERgBd0TQL5d89oEPUWCkMuRT16kLJAF T+9BxppGkZZUnc27H5Vn2A6Rht8hAaCixT/J7/70FjBoG/PGRlXgihk4Md9rRV5meH 3B79n5J03r8bxYrxkBFAgImDpZDcwqcw0noqKaD3HeBx+SCoDkj5SWaSGNIEhOgf/l O1p8WemxqC6HjxRT1CDRmlJq2c8j2FKCf3Ut5/92z3qP50j2tap7oaOGr5p1/hiFbG I6q6cnurEyhaQ== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OSX0019VYG04X30@pv33p00im-asmtp002.me.com> for internals@lists.php.net; Tue, 11 Jul 2017 19:36:07 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-11_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=32 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1707110316 Date: Tue, 11 Jul 2017 21:35:31 +0200 To: PHP internals Message-ID: <235f75aa-64d4-4099-849c-732ec0f1b585@Spark> In-reply-to: <03c18d51-f939-4031-a02e-8e84c44f2f5a@Spark> References: <03c18d51-f939-4031-a02e-8e84c44f2f5a@Spark> X-Readdle-Message-ID: 235f75aa-64d4-4099-849c-732ec0f1b585@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=5965289d_327b23c6_1579c Subject: Re: [PHP-DEV] String interpolation shortcomings From: ilija.tovilo@me.com --5965289d_327b23c6_1579c Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Oops, I actually meant to suggest the syntax =60=E2=80=9CHello =5C=7Bworl= d()=7D=E2=80=9D=60 (note: curlies instead of parens) to be closer to the = original syntax. Regards, Ilija On 11 Jul 2017, 21:10 +0200, ilija.tovilo=40me.com, wrote: > Hi everyone > > String interpolations are a great feature. They make your code more rea= dable and can reduce the number of allocations PHP has to make. > > Unfortunately, PHP is very restrictive in what kind of expressions stri= ng interpolation accepts. The only time you can actually use it is if you= r expression starts with the =60=24=60 symbol. You cannot use it for: > > - =46unction calls > - Infix expressions > - Constants or class constants > - Instantiations > - Expressions in parentheses > > Or anything else that doesn=E2=80=99t begin with the =60=24=60 symbol. > > Even more unfortunate is that =60=24=7Bfoo()=7D=60 is equivalent to =60= =7B=24foo()=7D=60 which means we cannot simply extend the current syntax = to support all expressions. Of course, we could deprecate the =60=24=7Bfo= o()=7D=60 syntax and reintroduce it with a different semantic meaning aft= er some time but this is far from satisfying. > > There is also the possibility of introducing new syntax for string inte= rpolation and deprecating the old one after a transition period (e.g. =60= =E2=80=9DHello =5C(world())=E2=80=9D). > > Does anyone think this is worth fixing=3F > > --5965289d_327b23c6_1579c--