Hacker News new | ask | show | jobs
by Koshkin 3383 days ago
This "problem" is not unique to Lisps. Quite often, when I look at a piece of code written in C++, especially when it uses lambda functions inside calls, I can't help asking myself why there are so many brackets (and whether a Lisp would be a better alternative to C++, syntax-wise).

The syntax of the lambda itself in C++ is sort of funny: it requires to use all the bracket types at the same time!

  [](){}
2 comments

But they're not interchangeable, so they give an person reading the code a strong hint whether it's a array index, function call/grouping, or a code block.
Oh, that's yet another issue: in the context of the above example (which, incidentally, was not merely a list of all kinds of brackets) the meaning of the pair of square brackets is changed from 'array index' to 'lambda'.
> and whether a Lisp would be a better alternative to C++, syntax-wise

IMO it's an open question. There is not much statically typed lisp AFAIK.