Scala considering significant indentation like Python

Mikhail V mikhailwas at gmail.com
Mon May 22 21:54:58 EDT 2017


> The creator of Scala, Martin Odersky, has proposed introducing Python-like
> significant indentation to Scala and getting rid of braces:
>
>   I was playing for a while now with ways to make Scala's syntax
>    indentation-based. I always admired the neatness of Python syntax
>    and also found that F# has benefited greatly from its optional
>    indentation-based syntax, so much so that nobody seems to use
>    the original syntax anymore.
>
> https://github.com/lampepfl/dotty/issues/2491


People sort of like indentation structuring.
It introduces some typography into source code representaion,
and restricts possibilities to [ugly]format the code.
I've looked quickly through the linked discussion, and not sure
if many think of the whole issue globally.

I understand the indentation, as well as many other syntactical tricks
as a trade-off for bringing nice code look in pure *textual* editors.
And that's one part of the indentation concept - a trade-off, assuming that one
looks at the code by means of relatively primitive text renderer.

Once I've came across this blog:
http://tratt.net/laurie/blog/entries/an_editor_for_composed_programs.html

This man seems to have the 'feel' for the whole issue and
I agree with his many points about the tendencies.

So to look slightly further than own nose -
I suppose the era of "char-by-char" code rendering/editing will not
last so long and code editors should deal with the code in
a structured way.
The question how exactly to show structure - as indent,
or vertical lines with nodes, will become just a user setup option,
same as colors, etc.
IOW for future human-oriented development environment,
the look of a source file in an average notepad should become
a secondary criteria, but a better *parse-ability* will become
primary criterion.

Even if speak about 'now' situation - looking e.g. into C code
I understand that braces are not the biggest problem for me.
I can ignore them more or less, but then come other readability
issues - lines starting with type names, unintuitive declarations,
asterisks jumping to the left or right depending on author's habits, etc.

So braces is not the major issue in the whole syntax problematics.
In some cases (though rare and if used with craft) they can help to avoid
unwanted indentations.
For sure an average indented Python code looks way better than
any 'braced' analogue and for common textual presentation
indented blocks is probably the optimal way.



Mikhail



More information about the Python-list mailing list