Hacker News new | ask | show | jobs
by minhm 2058 days ago
> it's the useless (unless you write an AST-rewriting macro) structure

In a good JS editor, how many key combinations and mouse clicks are required to jumping into, jumping out of, and cutting a block of code (eg. a function definition or a conditional expression), or transposing, merging, splitting, annexing, and de-annexing 2 blocks of codes? It usually takes me at most 2 key combinations with a Lisp editor (including navigating the cursor to the right place), thanks to Lisp's uniform structure.

> Say, naming a thing, a function definition, and a function invocation are all very visually different in, say, JS

Aren't these also visually highlighted in a Lisp editor as well?

Besides, a Lisp editor can optionally blur the parentheses so users don't mentally have to.

(edit: formatting, recounting the key presses required)

3 comments

> It usually takes me at most 2 key combinations with a Lisp editor (including navigating the cursor to the right place)

Is that in emacs/slime or another editor?

Emacs/slime.
> Besides, a Lisp editor can optionally blur the parentheses so users don't mentally have to.

How do I do that with spacemacs?

Try:

===

(package-install 'paren-face)

(global-paren-face-mode 1)

(custom-set-faces '(parenthesis ((t (:foreground "gray50"))))))

===

(edit: formatting)

In the user init file? I'm not an expert on spacemacs.
I believe it's also 1 or 2 shortcuts, thanks to the IDE's understanding of the language syntax, unless I misunderstood your scenario?

> Besides, a Lisp editor can blur the parentheses so users don't mentally have to.

Besides, another languages can throw away the parentheses entirely so neither users nor editors don't mentally or visually have to.

> I believe it's also 1 or 2 shortcuts, thanks to the IDE's understanding of the language syntax, unless I misunderstood your scenario?

I have not seen transposing, merging, splitting, annexing (moving a block into the inside another block), and de-annexing (the opposite of annexing) 2 blocks of codes in JS without using the mouse yet, so I just want to check.

> Besides, another languages can throw away the parentheses entirely

JS uses parentheses for grouping complex arithmetics and for function's argument lists (eg. func(arg) in JS vs. (func arg) in lisp). JS also uses curly braces to mark code blocks, which is similar to Lisp parentheses but at the cost of more complex parsing for the compiler and the mental distinguishing between functions' argument lists and code blocks on the coder (they are just lists).

JS statements use semi-colons, which makes editing them feel like editing lines of codes while editing Lisp statements is editing nodes of a tree, which is a very different experience.

> Besides, another languages can throw away the parentheses entirely so neither users nor editors don't mentally or visually have to.

Which mainstream languages have no brackets?