[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sweet-expressions are not homoiconic



I think it's fair to say the question is very subjective, if not religious â some people passionately hate significant indentation, some passionately love it. ÂBoth camps are willing to boycott languages of the other kind (or bend them to their will). ÂI've seen people be swayed by a few days or weeks of *experience* (happens to many python newbies), but never by theoretical arguments.

On Fri, May 24, 2013 at 1:09 PM, David A. Wheeler <dwheeler@xxxxxxxxxxxx> wrote:
Other languages that consider indentation in some way include
Haskell, Occam, and Icon. ÂAdding ABC means that there are
quite a number, and in particular, it's a *substantial* portion of the
more recently-developed languages that don't try to closely imitate C syntax.

Other notable examples:
- YAML which has largely won over JSON as a human-writable notation.
- Lists & quotations in Markdown, reStructuredText etc.
- The triumvirate of
 - HAML
 - Sass
 - Coffeescript

As for "expressing thought", a lot of pseud-code styles use indentation for grouping.

StructuredText was a notable cautionary tale - it used indentation for everything including chapter structure, which caused whole documents to be intented (similar to the define-library situation); reStructuredText was borne out of fixing that.

HAML/Sass/Coffeescript are interesting because they're preprocessors in front of existing languages, yet managed to gain non-negligible following. ÂAll three offer many shortcuts beside indentation.
Interestingly, YAML also offered much more than just "JSON with indentation".

Does indentation-sensitivity strongly correlate with bundling lots of sugar?
Must language constructs be influenced by indentation-friendliness?
Perhaps that's the sweet spot *for a single language*, but it's unfortunate in the big scheme of things. ÂExamples:
- A web developer learning HAML+Sass+Coffeescript must fit 3 different indentation/structure mappings into her head.
 Wouldn't one universal mapping be easier, even if less fine-tuned?
- Using distinct languages seems an disproportionally heavy price to pay for taste difference about indentation vs delimiters!
 A rare case: Sass now offers a delimiter-based CSS-compatible syntax (SCSS). ÂMost of the semantic sugar is shared with the indentation sensitive syntax. ÂIn an ideal world, we'd see more of this.
- Python tightly anchored the transition from indentation to delimiters to the semantical statement/_expression_ boundary. ÂAs a result lambdas are crippled forever â nobody came up with a satisfactory syntax for statements-inside-lambdas.
 If Python were defined on top of Sweet expressions one would be free to keep the lambda and the surrounding function call(s) in indentation land.

Neoteric & Sweet expressions advance the state of the art by separating infix and indentation sensitivity from the rest of the language design. ÂThis allows other sugar to be Âdefined over an already parsed tree (ideally via macros inside the language), which facilitates language innovation â same way s-expressions did.
Don't judge it merely on bringing indentation to the homoiconic Lisp world â it's also bringing the gift of homoiconity to the indentation (and infix)-loving crowd!

I don't know if the experiment will succeed, but I'm happy that David is trying.

--Â
Beni Cherniavsky-Paskin