|
|
|
|
|
by mamon
3322 days ago
|
|
The one significant effect of indentation-based syntax is that it makes copy-pasting code from places like books or Stack Overflow somewhat harder and error prone. I've been hit by this few times when learning Python, I can imagine it would cause some frustration for Scala users too. |
|
Allow both indentation-based and bracket-based syntax. Have a tool like scalafmt/goformat that freely converts between the two on a per-file and per-project basis.
When you're writing your own code, use the indentation-based syntax. You can paste in bracket-based code anywhere, hit the auto-format key on your IDE or run the commandline formatter and everything becomes nice and indentation-based.
When you're writing books, libraries, example projects, SO posts, use the bracket-based syntax. That way people who read your book/library source/example/SO post can freely copy and paste into their own projects.
This has minimal impact on bracket-based syntax diehards; everything they read and write stays the same. They won't even see the new syntax if they don't want to.