Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by kothar on Friday March 03, 2023 @02:47PM
(#35014149)
I assume because `\{` was not a valid escape sequence, which means any use of this character pair can be identified as a template without changing the semantics of existing string literals.
[ Parent
| on HN ]
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by aardvark179 on Friday March 03, 2023 @05:07PM
(#35015707)
Bingo!
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by layer8 on Friday March 03, 2023 @06:13PM
(#35016286)
More specifically: https://news.ycombinator.com/item?id=35016204
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by dmitriid on Friday March 03, 2023 @06:57PM
(#35016619)
This reminds me how PHP ended up with weird characters for various things (like namespace separators) because it was just easier to parse.
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by zelphirkalt on Friday March 03, 2023 @07:39PM
(#35016919)
PHP never stood out as a language with very clean syntax. It is very PHPesque to put the burden on the user of the language instead of going the extra mile and implement something that might be harder to parse, but would be more consistent. Inonsistency in general is one of PHP's issues.
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by sirsinsalot on Saturday March 04, 2023 @03:59AM
(#35019391)
if you ever had the misfortune of seeing the code for the parser and lexer of earlier versions of PHP youd see that it wasnt due to parsing simplicity but rather the author making poor syntax decisions due to a lack of understanding.
Then being walled in by backwards compatibility
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by colejohnson66 on Saturday March 04, 2023 @09:43AM
(#35021043)
Interesting, but not surprising for a language where functions were "hashed" as their identifier's string length. Do you have a link?
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by sirsinsalot on Saturday March 04, 2023 @01:49PM
(#35023322)
I do not, it'll be in whatever version control php is in though I'm sure.
Another absolute horror parser was the wikipedia wikitext parser. An ambiguous hand written mess of epic disgust.
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by kevincox on Saturday March 04, 2023 @03:04PM
(#35023987)
But you need the `FOO.` prefix anyways. So there was never any ambiguity. It seems that it would be good to either make the prefix optional (presumably something equivalent to the `STR.` processor would be default) or keep the interpolation syntax clean. (IMHO just `STR."Hello {name}!"` would have been ideal). But instead they require both the prefix and the ugly interpretation syntax.