rakitzis / rc

rc shell -- independent re-implementation for Unix of the Plan 9 shell (from circa 1992)
Other
252 stars 23 forks source link

Using ${} instead of `{} for command substitution #23

Closed v217 closed 7 years ago

v217 commented 8 years ago

Since you already improved upon the original rc-shell, I was wondering what you think about this idea about backquoting for command substitution: Using ${} instead of `{}.

The advantages are:

The disadvantages are maybe:

TobyGoodwin commented 8 years ago

My initial reaction is that this is a splendid idea! When I'm in a bourne shell these days, I always use $() over ``, and I find it something of a mental jump to go back to{}` in rc.

Assuming there are no syntax issues, I'd be in favour of adding this syntax. (Unfortunately, I don't think removing `{} is feasible, especially since some users are clamouring for more compatibility with the Plan 9 rc.)

@rakitzis any thoughts?

v217 commented 8 years ago

One option would be to implement a flag for backwards portability mode. So future modifications or additions would be worry free.

rakitzis commented 8 years ago

Interesting problem. Ironically this would have been a ksh feature, probably, long before it was a POSIX feature, and rc predates POSIX. But I also bet `{} was inspired by ksh $() so what goes around comes around.

I don't oppose this with the provisos: (1) no way is this a breaking syntax change, (2) no way is there a compatibility flag. Both forms would have to work going forward.

borkovic commented 8 years ago

Do we have corresponding syntax for backquote substitution with $ifs override? Also, how did you highlight backquotes?

nobrowser commented 8 years ago

By the way, Emacs (up to 24.5) has completely broken highlighting for this construct. It seems to be looking for the closing backquote which never comes ... If this proposal is adopted, I can at last start writing rc scripts, the one religiously correct editor being available for the purpose :-)

rakitzis commented 8 years ago

Ironic that the 10kloc C program would need to be bent to the will of the Turing-complete editor with full Lisp ecosystem built in.

TobyGoodwin commented 7 years ago

I've gone off this idea.