2 ms·
Untyped syntax is a defining chracteristic of shells. This answer by Jörg W Mittag is very convincing: https://stackoverflow.com/a/3640403/512904 https://stac
by matheusmoreira 3y ago
Untyped syntax is a defining chracteristic of shells.
This answer by Jörg W Mittag is very convincing:
https://stackoverflow.com/a/3640403/512904 https://stackoverflow.com/a/3640403/512904
This table in particular is very illuminating:
| Ruby | Bash
-----------------------------------------
number | 123 | 123
string | '123' | 123
regexp | /123/ | 123
file | File.open('123') | 123
file descriptor | IO.open('123') | 123
URI | URI.parse('123') | 123
command | `123` | 123
Here's a similar table with add your example's syntatic elements:
| Lisp | Bash
-----------------------------------------
command | `ls` | ls
function | (myfunc) | myfunc
string | "afile" | afile
redirection | (out-to "afile") | >afile
- amno 3y agoIndeed. However you can achieve things like that in an ordinary Lisp via unevaled (special) forms, with other words, macros. In Emacs Lisp eshell does it too, though they have extra advantage since Emacs has built-in text editor and text processing extensions. Eshell implements both Bash and Lisp syntax. I am not sure if "sharp lisp" does anything special for scripting than any other Lisp, but it is possible to do.
- matheusmoreira 3y agoThat's true but when you do that it's not really lisp anymore it's another language you just created and implemented as a lisp macro.
- amno 3y agoIndeed; that is my objection to the loop and format in CL. But on the pragmatic side, if you want to interop with shell, or some other language/runtime, isn't it sometimes easier and less typing and noise if a program can be expressed in DSL or as a mix of Lisp and a DSL than if everything is written in pure s-expressions?