7 ms·
I'll take the downvotes, and no disrespect to the project itself - but only to the falling-over-self comments about ClojureScript. If you care about semantics
by tomlin 5y ago
I'll take the downvotes, and no disrespect to the project itself - but only to the falling-over-self comments about ClojureScript.
If you care about semantics at all, or even want your code readable by someone who is in their early days of trying to understand and learn code - it's just ugly and hard to read.
I've been coding since I was 14, and I don't feel bad in saying that I can't tell you what this line does without looking it up. (reset! caret-location nil)))) I can't imagine how you could argue this is good and adheres to any philosophy of openness or readability.
- zests 5y ago(? ((have you written) lisp before))
- remontoire 5y agoThis argument doesn't hold anymore now that there are threading macros. (-> ((have you written) lisp before) ?)
- dhosek 5y agoMy comment got prohibited while the parent was flagged, but the example code seemed pretty understandable to me and I've never written a line of lisp code in my life (the closest I've come is cutting and pasting lines into an emacs config file). While Lisp has claimed ownership of all the parentheses that Python has eschewed, it's a more than reasonably readable language and predictable in its syntax.
- boondaburrah 5y ago(has? (previous-experience 'lisp))
- wffurr 5y agoYour comment implies that you’re only familiar with C-style curly brace languages. ClojureScript is a Lisp language. If you’ve never learned one, I highly recommend it. It will make you think about programming differently. As esr puts it in his (in)famous “How To Become A Hacker”: “LISP is worth learning for a different reason — the profound enlightenment experience you will have when you finally get it. That experience will make you a better programmer for the rest of your days, even if you never actually use LISP itself a lot.” http://www.catb.org/~esr/faqs/hacker-howto.html#skills1 http://www.catb.org/~esr/faqs/hacker-howto.html#skills1 For myself, I learned Scheme (another Lisp-like language) in graduate school through the How to Design Programs curriculum (http://htdp.org/ http://htdp.org/), which despite already being a professional programmer, I found enlightening. And then again in the online programming languages course from Brown: https://cs.brown.edu/courses/cs173/ https://cs.brown.edu/courses/cs173/.
- toastal 5y agoLISP is super easy for humans and machines to parse which makes it readable and I'd be hard-pressed to call it ugly for that reason--I think it's pretty darn easy to read having fairly small exposure to LISPs. I personally prefer ML-family syntax and never liked the ergonomics of working with parentheses, especially in Vim, but I agree the parent comment reeks of exposure bias making claims about what others know and should feel comfortable with.
- thiht 5y ago> LISP is super easy for humans and machines to parse You have to choose 1, it’s either easy to parse for machines or for humans, not both. Any kind of lisp is harder to parse for humans.
- kazinator 5y agoProgramming languages in which line breaks and indentation are not significant are hard to parse for humans, period. Take any Javascript or C program, and remove the line breaks so that it's just a linear string of tokens. It's no harder for the parse for the machine. Much harder for you. Humans parse non-trivial examples of Lisp using indentation clues that the machine ignores, just like in the case of a large number of language families. Not all structure in programs is indicated with indentation; sufficiently small chunks of programs are written on one line. The structure of those chunks is easy for humans to understand accurately if they are written in Lisp because there is no ambiguity. Lisp syntax also has a way to break any expression, no matter how small, into multiple lines with indentation. Any two Lisp programmers will do it the same way: (+ (* x x) (/ y z)) there are no questions like "do I put the slash at the end of the previous line"? If you can't understand some one-line chunk of code, you can get it into a canonical indented form, and this can be automated.
- tomlin 5y agoIf it's so easy, why are none of the early code learning platforms employing Lisp or Clojure? An honest answer is that it's too hard to read for children who are learning. It's not easy, saying it is doesn't make it so. Ask a kid if it's easy.
- Dylan16807 5y ago> I don't feel bad in saying that I can't tell you what this line does without looking it up. This is something that you could learn in a single minute. It's faster to learn than all the languages you know. > (reset! caret-location nil)))) The C version is reset(caret_location, nil) Or to be more precise, reset(caret_location, nil)))) Maybe null or NIL instead of nil, maybe not. It's barely different. And the exclamation point is just part of the function's name. I'm not sure what's so confusing.
- Noumenon72 5y agoAn exclamation point being part of a function's name is certainly surprising to me. It would be like learning that `foo[5]` was a function named `foo[` being called 5x or something.. (Apparently it's a ClojureScript convention to put an exclamation point on impure functions.)
- Dylan16807 5y agoEven though the blog is syntax highlighted?
- sixstringtheory 5y agoExclamation marks are also used in Ruby to differentiate between mutating methods vs those that return a transformed copy. So, `array.sort` vs `array.sort!`. Question marks are also used, but more aesthetically vs functionally: there are `array.empty?` and `array.include?` but no `array.empty` or `array.include`. Swift allows unicode in symbols, so you can name functions with emoji. Thankfully that hasn’t caught on. J has a similar idea–built into the language syntax vs using characters in function names–where a period can be used to inflect a primitive.
- tomlin 5y agoIt's not about having an open mind. I teach children to code, and you'll notice that there are ZERO early coding learning platforms that take a Lisp/Clojure approach. Do you think that is a coincidence or because it's an ugly language that people can't easily read at an early age?
- knubie 5y agoWhy would you expect to know what a line of code does in a language you've never used without looking it up? If you've ever used hooks in react it is roughly equivalent to setCaretLocation(null).
- remontoire 5y agoDoes: reset!(caret-location nil) Make more sense to you? Maybe you would like OO style? (-> caret-location (reset! nil))
- userbinator 5y agoSurely you would also say that Chinese is "ugly and hard to read", if all you've ever seen are Latin-family languages? It's a Lisp. Takes 5 minutes to learn the syntax - but only if you have an open mind. (My daily work is in a C-derived language, but I have zero problems parsing Python, Lisp, or even APL if I need to. )
- karottenreibe 5y agoThat's a poor comparison, given that reading Chinese requires you to memorize thousands of symbols that have little internal consistency or rules to deduce their meaning. It's _actually_ really hard and time intensive to learn to read. That doesn't make it ugly of course. Just not well suited for the analogy you're trying to make. I guess Arabic would be a better fit here, since it has an alphabet, if I'm not mistaken.
- tomlin 5y agoIt's not about having an open mind. I teach children to code, and you'll notice that there are ZERO early coding learning platforms that take a Lisp/Clojure approach. Do you think that is a coincidence or because it's an ugly language that people can't easily read at an early age?
- userbinator 5y agoThat's down to popularity more than anything else.
- boondaburrah 5y ago"I've been coding since I was 14, and I don't feel bad in saying ... I can't imagine how you could argue this is good and adheres to any philosophy of openness or readability." is like saying "I have experience, therefore that invalidates any experience you might have." If you don't have any interest in perspectives outside of your own then I can't imagine learning anything can be easy at all. Since I come from a school where scheme was taught as a first language, I find clojurescript a hell of a lot easier to read than javascript. Half the time I feel like javascript just does things out in the aether with side-effects and I find the code really hard to follow when it does. Clojurescript has a much easier to follow flow for me. That doesn't mean javascript is ugly and hard to read for someone else.
- tomlin 5y agoIt's more like "I want the world to understand code, and I don't think we get here with bougie languages that divide learning instead of emboldening it." Language should be easy, it shouldn't be a ring-kissing circle jerk. Clojure is not on any early learning platforms. There's a reason for that. Children don't understand brackets, cause you know, children. If you look at the data on children learning languages, Lisp and languages like it actually divert wouldbe programmers away. Not something I consider positive.
- askonomm 5y agoYou seem to be pushing the children narrative very strongly, as if it were some deciding factor on what languages adults should learn for their own pleasure and what not. At no point was this article directed at children. If you do not like Lispy languages and find them hard to understand, that's totally fine, but that is every bit your problem, not mine.
- tomlin 5y agoLet's completely forget for a second that the article wasn't basically prescribing ClojureScript as a omnisolution that we're all dumb for not converting to - it was my opposition that the point is ignorant of 99.5% of the rest of the world. His argument was that is was readable - it isn't. Again, ask someone who's learning whether it's readable. And I better not find you in a thread, arguing that semantic HTML is far superior while you flog for a non-semantic language.
- askonomm 5y ago> it's just ugly and hard to read. Beauty is in the eye of the beholder, as they say. But, like I mentioned in another comment here, it seems odd to me to criticise on the merit of choice of language on a programmers forum.
- tomlin 5y agoI teach children to code, and you'll notice that there are ZERO early coding learning platforms that take a Lisp/Clojure approach. Do you think that is a coincidence or because it's an ugly language that people can't easily read at an early age?
- askonomm 5y agoI think it's market effects and nothing else. Schools teach first and foremost the skills that are easily employable. Hence why most schools teach either Java or JavaScript these days. Whether or not something is nice to read (btw, what does this even mean? Your lack of experience is not an indication of how "easy to read" something is) has pretty much nothing to do with it. I hope this is not the attitude you teach children with, because if you think something you do not understand is by default ugly, you have bigger problems than my small blog post. I also do not write my blog for children to read. In fact, I don't even have a target audience - it's all "I had a problem and this is how I solved it", and perhap some Clojurian finds my posts on Google and finds it interesting. I certainly know there are Lisp-likers here on HN, as well.
- tomlin 5y agoCode should be for everyone - not just a few ring-kissers who feel they have past a certain integrity threshold - or maybe better said, you think Lisp is some sort of Master Sword that you pulled out of the rock - so therefore, it must be better. What does "nice to read" mean? It means that I don't spend another 2 hours falling over myself trying to convince 7 year olds why being decisively pedantic is better than more expressive, semantic code. You're still caught up in the idea that coding and programming is for an elite group of people, and that perspective is boring and old.