News for hackers. Stuff that matters.

Ask HN: Lisp's parentheses are bad but Elixir's `end`s are okay?

Why do people hate Lisp's parentheses so much, but they don't find this abomination a step back:

Example Elixir code:

  defmodule A do
    defmacro __using__(_env) do
      quote do
        defmodule Math do
          def plus_itself(y) do
            y + y
          end
        end
      end
    end
  end

It also happens in Ruby and several other languages. Typing "end" is three key strokes whereas ")" is just one or two, depending on your keyboard configuration.

And IMO multiple "end"s are much uglier than multiple parentheses.

( 5 comments | on HN )
Re:Ask HN: Lisp's parentheses are bad but Elixir's `end`s ar... by taylodl on Tuesday August 06, 2024 @03:24PM (#41174302)
And in Lisp I can end an expression such as this with:

)))))

which allows you to quickly see the expression has been ended. I think Lisp has had trouble when people attempt to use parenthesis as begin/end markers and put them on separate lines and try to line them up vertically. Don't do that!

Re:Ask HN: Lisp's parentheses are bad but Elixir's `end`s ar... by behnamoh on Tuesday August 06, 2024 @10:59PM (#41177835)
I guess you use Parinfer and structure editing, which is really cool!
Re:Ask HN: Lisp's parentheses are bad but Elixir's `end`s ar... by m-onz on Tuesday August 06, 2024 @02:38PM (#41173823)
I like params and end.... I would happily use lisp or elixir... LFE is really cool.
Re:Ask HN: Lisp's parentheses are bad but Elixir's `end`s ar... by arrowsmith on Tuesday August 06, 2024 @02:33PM (#41173767)
meh, you get used to it.
Re:Ask HN: Lisp's parentheses are bad but Elixir's `end`s ar... by behnamoh on Tuesday August 06, 2024 @02:36PM (#41173807)
But with parentheses we get the full power of Paredit and Parinfer, is there such a thing for Elixir's ends?