The editors strike back
Interesting edge cases with evil-cleverparens and another question about choice of editor for complete beginners to programming.
Covid strikes again. Wiped out by the end of the week.
Clojure CLI Configλ︎
Monthly update for libraries used in the Clojure CLI Config.
Spacemacsλ︎
Some curious edge cases for evil-clever-parens where deleting within a hash-map leaves the hash-map unbalanced.
This behaviour was found in Spacemacs although it could be another package or config causing the issue as the same edge cases are not present in vanilla Emacs.
When modifying a hash-map with evil-cp-delete-line
(D
in Evil Normal state) the hash-map closing paren can be deleted and become unbalanced. This seems to happen either a flat hash-map or nested hash-map.
evil-cp-delete-line
correctly keeps balance when the hash-map is surrounded by a different type of parens, eg. list or vector.
Example
;; D deletes closing paren on first line - unbalanced, although dd does work as expected
{:get {:handler :get-clojure}
:name ::main}
;; deletes closing paren - unbalanced
{:get :clojure}
;; delete anywhere in hash-map keeps balance
[{:get :clojure}]
;; delete anywhere leaves unbalanced
{:get {:closure {:with ::clojure}}}
;; delete within hash-map keeps parens balanced
(clojure.pprint/pprint {:get :clojure})
;; delete within hash-map keeps parens balanced
(def data-analysis
[{:get :clojure}])
;; delete in vector keeps parens balanced
[:get :clojure]
;; delete in hash-map keeps parens balanced
[:get {:clojure :repl}]
I did not find any issue from an initial review of the Spacemacs configuration and use of evil-cleverparens in the Spacemacs configuration.
These seem edge cases to me anyway as I replace the value in the hash map rather than use line-delete with a value from a key value pair, as logically deleting only the value unbalances the semantics of the hash-maps itself.
Editor for Beginnersλ︎
Which editor is the easiest for complete beginners to use for learning Clojure?
This was a question this week in the Clojurians Slack community and there are always variations on the theme of which editor to use.
Tooling biasλ︎
It is very hard to see past our own biases when it comes to the tools we use every day. A deep connection is made to the editor of choice and becomes hard to overcome this affinity.
We naturally want people to validate our own tooling choices by encouraging others to use the same editor.
This kind of bias can be avoided by first acknoledging that it is ever present. Using several editors can also reduce some bias as well as providing a deeper understaning of the strenghths and constraints of each tool.
Practicalli uses Neovim and Emacs regularly
This blog and most new content is created using Neovim (with AstroNvim). However for most of the last decade the Practicalli content has been created with Emacs (with Spacemacs).
No editor or development experienceλ︎
Using a text editor that supports Clojure syntax highlighting is the simplest approach. Using a terminal REPL prompt to load files.
My suggestion is Clojure Sublimed is less complicated than any other tools. Or Rebel Headline could be used for very small pieces of code. Or choose a tool that has very clear and accurate guides, so the beginner progress without getting stuck or requiring significant help from a teacher/mentor. The only editor / IDE that will feel simple to the learner is the one they become familiar with (or can be taught the essence of in a short space of time).
IDEs will feel very complex because they have lots of features to distract & confuse someone with no context.
Anyone guiding beginners will have experienced how distracting a large number of features can be, they quickly get in the way of learning (and teaching).
Early days of Clojureλ︎
LightTable was first editor that really helped me feel comforatable with Clojure and REPL driven development.
The editor was not perfect, but was extremely simple to use and provided really useful feedback as code was typed.
Unfortunately the LightTable editor was discontinued, even though there was an effort to revive it after the original maintainer passed.
Thank you.