Martin Coxall <pseudo.m...@me.com> writes: > My question is this: why can't we introduce a simple and importantly, > optional 'off-side rule' (much simpler than Haskell's) that allows the > reader to infer many of the parentheses?
If you haven't seen them before, check out sweet expressions. This guy has put a lot of thought and experimentation into it. http://www.dwheeler.com/readable/sweet-expressions.html Coming from a background in Python and Ruby, I found S-expressions initially very hard to read and would probably have loved something like this. However I pretty soon got used to the Lisp syntax and now I actually prefer it. If I did use something like sweet-expressions as "training wheels", I'd probably have stuck with them and then never have learned to read other people's code and never discovered the joy of paredit and SLIME. It's possible to use paredit with other languages, but it doesn't seem to work as well due to the lack of consistency. Similarly, I have tried a couple of SLIME-like things for Ruby and Python but they never worked quite as well as you have to resort to manually selecting everything you want to eval, instead of just being able to say "eval last expression". I guess in theory it should be possible to make this work with an infix/whitespace-sensitive syntax but the amount of extra effort involved must discourage implementation efforts. I agree with Anniepoo, if you really want to do something like this it's probably better done in the editor rather than the language itsel. By putting it in the editor, you're retaining the simplicity in the actual source-code, plus any file you open will be in your preferred syntax and when you give your code to other people it will be in their preferred syntax. In fact it looks like there's already an Emacs mode for doing it on a read-only basis: http://www.emacswiki.org/emacs-zh/UnParenMode I have at some point seen a mode that makes them invisible for editing as well and uses whitespace and highlighting to indicate nesting, but I can't find it now. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en