Hacker News new | past | comments | ask | show | jobs | submit login

Thats... similar but I wouldn't call it "more elegant". It's less clear in almost every way.

Why c? Why the quote? Why not have elegant language syntax instead of that clunky macro?




I put `c` there because `destructuring-bind` is lexically scoped and only binds values to names inside of it. This may be a good or a bad thing, depending on your use case, but I prefer having the scopes clearly visible.

The quote is a multi-purpose element of the syntax, unlike `[` in Python, which only serves a single purpose (actually, it doubles as an item getter syntax). Whether having a single, more universal construct which you can use in many situations, or having a few more specialized constructs is more elegant is debatable and I think a matter of taste.

The problem with having specialized syntax for this is that it's not extensible. For example, we (I'm a Python programmer, too) had to wait for 3.4 (IIRC) for a very simple feture of `a, b, *c = range(10)`; with a language built on macros you can extend these constructs as much as you wish. For example adding support for destructuring hash-maps (if it's not supported already) shouldn't be a big problem; on the other hand adding a specialized syntax for dict destructuring in Python is impossible within a language.


Good explaination! Thank you!

That does explain it very well but I'd also argue that a syntax that requires that much explaining probably can't be called "elegant".

Powerful though? Yes. Lips syntax certainly is that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: