Live data from Hacker News

My thoughts after using Clojure for about a month

acdw.net

111–120 of 204 posts

Re: My thoughts after using Clojure for about a month

#111

Earlier quoted context omitted.

Thousands of share-nothing actors (fibers / green-threads) with first-class support for communication between them, for a start. Erlang/Elixir -- immutability as well.

>share-nothing actors although this is a deliberate choice rather than some accidental defect. Clojure went with STM as its concurrency model, if you're not buying into that and you want an Actor-centric language it's not the right choice to begin with.

STM is seldom used in modern Clojure projects, it is certainly not the dominant model. Most projects I am aware of use a few or even exactly one atoms with immutable data structures.

Re: My thoughts after using Clojure for about a month

#112

    ;; This is real syntax!
    (loop for k being the hash-keys
          using (hash-value v) of hash-table
          ...)
Still lisp. Although the blog author has a point - clojure is probably cleaner lisp than common lisp.

I think the issue is heavily due to syntax though. Naturally the (())()()()(), but I think even aside from the (), the syntax does not seem super-efficient to me. Perhaps I have spent too much time with ruby and python, but it feels as if lisp is a legacy regression, purely syntax-wise.

Re: My thoughts after using Clojure for about a month

#113
post #3

> I am now generating this website with Clojure As everyone knows, you are not a true lisper until you have written your own static site generator. It gave me such a great high with how easy it was to add my own "templating engine" on top, implemented all using macros. The downside is that the crash came hard; there is so much more to a good static site generator such as optimizing the output, supporting scoped CSS,…

> As everyone knows, you are not a true lisper until you have written your own static site generator.

I think that part is quite normal. I use ruby for the same purpose, though the only difference is that the code I use is also to be used for dynamic websites at the same time (cgi, rack, sinatra, in theory ruby on rails but I just can't stand rails and DHH these days, so I am in the opposition crowd). Using static websites, though, always feel as if I have significantly less flexibility. I do generate some static .html files as well, but they feel less useful to me, aside from being displayed faster, of course.

Re: My thoughts after using Clojure for about a month

#114

> The seq abstraction, for example, means I usually don’t have to worry about what kind of sequence I’m dealing with Eh? That's completely lifted from CL ( https://www.lispworks.com/documentation/HyperSpec/Body/t_seq... ). Same for AREF/NTH, there's ELT. Other than that, I agree, CL is baroque yet needs some hole filling here and there. > Lisp: everything is a list But that's wrong. Not even a little. Unless you mean…

> `(let [a b] ...)` instead of `(let (a b) ...)` is _not_ okay

it is however quite consistent, clojure uses vector form for most macros that require a "control" form before a "data" form: argument list in defn, names list in let, iteration descriptors in for, etc. you get used to consistency quite easily.

Re: My thoughts after using Clojure for about a month

#115
post #79
post #4

> I do wish there were an easier way to move in the ]}]})))}-ness of block ends though. I’m not quite sure what this means. How is it different/worse than all parens..? fyi I use paredit and just hit ) and it moves me past any kind of paren/bracket. But even without that you can just hit left and right..?

I use Emacs's built-in structural editing bindings, which doesn't have the auto-move-past any kind of paren/bracket thing. Maybe I could add that in. But I was talking about like, when refactoring, I'll maybe change something from a list to a vector, and I have to change the delimiters at front and back. Or, where electric-pair does do the move-past-all-parens thing when I just spam ), it doesn't do that with ]}]}]]}…

I don't recall the exact name, but I believe it's forward-up-sexp which allows you to jump forward past the next closing delimiter. Though if I'm not mistaken only the backwards one has a default binding.

Re: My thoughts after using Clojure for about a month

#117
post #6

With respect, this topic in particular has been beaten to death. I too liked Clojure when I tried it some years ago (agreed on the composition and data structures; both are _great_). But the real value-add is in the runtime, not the syntax. Java has a solid runtime but it's not yet as good as Erlang's, maybe even not up to the standards of Golang -- I am talking concurrency / parallelism here (for memory management I…

I think you might reevaluate the runtime claim, since the JVM is perfectly capable of stackful coroutines these says.

Re: My thoughts after using Clojure for about a month

#118
> "I do wish there were an easier way to move in the ]}]})))}-ness of block ends though."

If he means navigating the AST, there is Parinfer: https://shaunlebron.github.io/parinfer/

Paredit / Parinfer ruined other languages for me. It lets you navigate up/down/in/out of the Clojure AST with keyboard commands and mutate those expressions, e.g. "Split" will split open the current data structure you're in: `(a| b)` =Split=> `(a)| (b)`, where | is caret. Join is the inverse, and it works for all data structures.

Re: My thoughts after using Clojure for about a month

#119
post #62

Earlier quoted context omitted.

> Programming language syntax scarcely matters. Certainly it matters much less in the modern era. However, certain fundamental decisions of a language can be dealbreakers. Requiring declarations on your functions and giving those declarations sigils so that they can be parsed quickly is an important syntax decision. Almost every modern programming language has converged to this idea. Or take, for example, Lua. For me…

I agree with most of what you said, but I am puzzled about your claim about RAII. Whether it is good for any kind of resource acquisition to look the same like an initialization is debatable. On the other hand, I cannot see any counterargument to the principle that releasing any resources should not be done explicitly, but only implicitly, upon leaving a block (using reference counts for shared resources). I doubt th…

> I doubt that you advocate for the use of explicit release commands for resources, which are a notorious source of bugs, so what is that you consider as not being the same as RAII?

Those are not the only choices.

Garbage collection is at one end of the spectrum--fully manually managed is at the other end of the spectrum. There is also another axis of acquiring/releasing allocation by object or acquiring/releasing object by pool. And, if you have it, there is the axis of allocate only at startup and never free until end of thread/application vs. allocate only at a frame of of time and then destroy them all at the next frame vs. allocate whenever and wherever.

RAII encourages the usage of lots of tiny individual objects allocated whenever and wherever all with their own lifetime cycles and makes understanding the memory usage of your application very difficult (this was the whole reason Rust was made--C and C++ made managing memory in Firefox ridiculously diffused and impossible to corral).

And, I'll be blunt, I think that Rust/Zig/C3 etc. are not the right direction in spite of the fact that I use Zig a lot. I think that the garbage collected languages cede far too much in terms of performance to the compiled ones and GC languages (like say OCaml) should be being used for systems programming more often.

For example, I think we would all be in much better shape against AI vulnerability scanners if more systems programs were in GC-type languages.

Re: My thoughts after using Clojure for about a month

#120
post #118

> "I do wish there were an easier way to move in the ]}]})))}-ness of block ends though." If he means navigating the AST, there is Parinfer: https://shaunlebron.github.io/parinfer/ Paredit / Parinfer ruined other languages for me. It lets you navigate up/down/in/out of the Clojure AST with keyboard commands and mutate those expressions, e.g. "Split" will split open the current data structure you're in: `(a| b)` =Spli…

Indeed. The incredibly clumsy way we choose to edit source code has baffled me since I was first acquainted with parinfer. Having to keep the source in the shape of a valid AST almost entirely manually is really annoying.
Post reply on HN