zlacker

[parent] [thread] 1 comments
1. Aachen+(OP)[view] [source] 2022-12-08 13:05:35
Ah, okay that's a much smaller change then. Thanks for the info and link!

Kinda odd that Bash has had this syntax since forever, Perl as well, JavaScript went out of its way to add it as well, and now php is like: let's remove this syntax specifically but allow typo variants of it!

Oh well. Not like I was using it, that is, I use the bare "$foo" syntax and try not to make string interpolation too complicated with inline expressions or some such. Just, I could have seen the logic behind switching to the more universally supported syntax and deprecating something else rather than doing their one-off thing.

replies(1): >>colonw+a1
2. colonw+a1[view] [source] 2022-12-08 13:13:43
>>Aachen+(OP)
In bash/shell the expression $a is "just" a shorthand for ${a}, which is the more general syntax. Shell does not really make a distinction between string interpolation and ... well, everything else. It's a bit like how we don't always have to write out the curly braces of an if statement in C.

I'll also point out that in shell assignment looks like

  a="foo"
not

  $a="foo"
The dollar sign of shell feels to me more like an operator you use when you want to access the value of a variable. Not a part of the name of the variable as in PHP.
[go to top]