4 ms·
> Every lisp hacker I ever met, myself included, thought that all those brackets in Lisp were off-putting and weird. Not me. I used C before Lisp, and Pascal b
by kazinator 5y ago
> Every lisp hacker I ever met, myself included, thought that all those brackets in Lisp were off-putting and weird.
Not me. I used C before Lisp, and Pascal before that. C replaced syntax like BEGIN and END and "END <procedure name>" with just { }. I thought this was a most excellent thing.
I was still not using Lisp when HTML and then XML came along. My reaction to XML was this: since most of the content of XML is payload data, why don't we just fscking use parentheses or braces to structure it? Some {foo bar {baz}} or whatever instead of this moronic, bandwidth-wasting, unreadable nonsense <foo>...</foo>.
I could understand it when the markup is just a few raisins in the pudding like:
> Lorem ipsum dolor sit amet, <i>consectetur</i> adipiscing elit, sed do eiusmod
but this XML thing made no sense as a data notation in which every little leaf element is wrapped in verbiage.
So then when I got into Lisp, it basically had the syntax I already wanted; it was "pre-approved".
I already liked parentheses because they occur in English prose (like this), in mathematics, and in almost every programming language I had ever used.
The Unix shell and other command languages eliminate the commas: we don't write
tar, czvf, foo.tar.gz, foo
Moreover, command arguments are not restricted to narrow lexical categories like "must begin with letter or underscore ..."; they are just clumps of non-whitespace characters. If you know any command languages, what Lisp is doing in that regard is obvious; you're not confused by a+b just being an argument, different from a + b.
Commands with the main function on the left followed by space-separated arguments occur in parentheses in POSIX command substitution syntax:
printf "[%s]\n" "$(cat file1 file2)" > file3
dironly=$(basename $(dirname a/b/c))
In general, by the time I got into Lisp I had written so many scanners and parsers, solved so many shift-reduce and reduce-reduce conflicts and whatnot, I knew a good thing when I saw it.
- threatofrain 5y agoYAML sort of addresses this, but I really wish companies would just go with Lisp when they want to do weird DSL's, such as, ahem, Ansible with their weird YAML. As weird as Lisp is, it can never be as weird as learning idiosyncratic languages for different products. It is the most minimalist machine-human compromise for lists of lists.
- smw 5y agoYES! Preach! Stop making me write DSLs in things that aren't programming languages, and start using programing languages that naturally allow DSLs.
- eyelidlessness 5y agoYes, let’s dump YAML. Yes, let’s dump arbitrary DSLs for declarative data structures. Yes, let’s adopt a lisp’s syntax. Just... let’s adopt the one (EDN) with more than one kind of bracket, some kind of traction, a surprisingly good mapping to static types, and a surprisingly robust compatibility with existing tooling (Transit).
- rofrol 5y agohttps://www.reddit.com/r/Clojure/comments/d967fd/pitfalls_and_bumps_in_clojures_extensible_data/ https://www.reddit.com/r/Clojure/comments/d967fd/pitfalls_an...
- eyelidlessness 5y agoIt’s true there are some rough edges here, notably mostly in the actual Clojure(Script) implementations (unfortunately unsurprising) rather than in EDN. Also worth emphasizing that Transit addresses many of the issues highlighted (as well as EDN’s biggest downside outside the Clojure ecosystem: it’s slow).
- deleted 5y ago[deleted]
- throwaway77112 5y agoWhat about UCL? https://github.com/vstakhov/libucl https://github.com/vstakhov/libucl
- curryst 5y agoThere are places where it makes sense. I don't love Kubernetes' YAML, but it makes sense as a serialization format. I think LISP would be out of place here firstly because your serialization format really shouldn't be executable, and secondly because it offers few advantages. You can implement any DSL you want and just have it output YAML. Ansible really should have ditched the YAML format a long time ago. The YAML is practically designed to be executable; I'm almost surprised that you can't add a shebang line pointing to Ansible at the top of your YAML. I'm actually a little surprised they've never offered an option to write parts of your Ansible setup in Python. I would love to make some of my roles and my playbook into Python code. I am forever googling the syntax to set up a loop in Ansible YAML, as well as how to make dependencies between roles, which is pretty cleanly solved with Python modules (just import and execute the role at the top of your new role).
- tempodox 5y agoI couldn't agree more. Came here to say the same.