5 ms·
I find it very hard to work with a mixture of brackets and parentheses. Does anyone else prefer an all-parentheses syntax for reading and typing?
by sigjuice 10y ago
I find it very hard to work with a mixture of brackets and parentheses. Does anyone else prefer an all-parentheses syntax for reading and typing?
- markx 10y agoI actually prefer the mixture. It's a better visional cue.
- yarrel 10y agoYes. The switch between different pairs if you're not using just parentheses is a real cognitive load.
- mschaef 10y agoI don't mind either syntax, but what's essential is an editor that highlights balancing parens, etc.
- yellowapple 10y agoHence why I love Emacs: http://melpa.milkbox.net/#/hl-anything http://melpa.milkbox.net/#/hl-anything
- krylon 10y agoIn a Lispy context, I find brackets confusing. But then again, I don't know Clojure. (To me, it is a context thing, I think - in lagnuages like C/C#, there parens, brackets, parentheses and even angle brackets flying around, and it is not a problem at all.)
- wavegeek 10y agoI agree. I recently had to write a project in Ruby and all this random syntax is driving me mad.
- deleted 10y ago[deleted]
- hkjgkjy 10y agoWell, in most cases `[]` is used just like you'd use a quoted list `'()`. Clojure vectors are nice for the performance they give. Having maps with `{}` syntax is also nice if you ask me. Makes reading a little bit faster.
- junke 10y ago> Clojure vectors are nice for the performance they give. What difference does it make when representing code?
- weavejester 10y agoVectors eval to themselves, while lists eval to a function/macro/special-form call. Vectors also differ from lists in that they are ordered and indexed, so in macros and special forms they tend to be used to represent positional bindings.
- junke 10y agoThis has nothing to do with performance. Also, there is no such clear distinction in how vectors and lists are used. You still require context to know if a vector is evaluated to itself or not, or if a list is a call. Without context, you can't say looking at [x y] which of x or/and y is being evaluated: (let [a [x y]] ...) (let [x y] ...) (fn [x y] ...) As for parenthesis, you have special cases too: (defn foo ([] (foo 0)) ([n] ...)) And sometimes, people aren't sure about what to use: https://github.com/bbatsov/clojure-style-guide/issues/64 https://github.com/bbatsov/clojure-style-guide/issues/64
- hkjgkjy 10y agoWhat I meant was that [] when glancing just means the same as '(). I was thinking about it over the day, and realized maybe having special syntax actually is confusing - maybe "normal" lisp with only parens is better. Thanks for the eye-opener.
- junke 10y ago
- kazinator 10y agoI hate the stupidly gratuitous use of vectors in specific syntactic roles like the denotation of variable bindings. That applies regardless of how they are spelled, be it [...] or #(...).
- Johnny_Brahms 10y agoI use [] only in certain spots for my scheme code. For binding variables in a let-block and for cond clauses. (let ([a 5] [b 6]) (display a+b)) I find this easier to parse mentally, but I can see why one wouldn't do it, especially for cond clauses where you might end up having to actually browse parens to add or remove before or after the ]. I use paredit now, so there is really no need for me to do think about parens much at all, but old habits die hard.