Scala considering significant indentation like Python
On 22/05/2017 14:59, Jussi Piitulainen wrote:
> Cholo Lennon writes:
>> I am a huge python fan (but also a C++ and Java fan) and I agree with
>> Scala creator, sometimes the readability is complicated. So, more
>> often than I would like to, I end up missing the braces :-O
> I am the inventor of multiple ends on the same line. This way, in a
> language where all of several nested constructs end with an end - not
> going to name the language but it's Julia - instead of
> one combines the uninformative lines into one by writing
> end end end end end,
> and with four-space indentation the ends align neatly with the starts.
> Technically, the ends on the remaining line of ends are backwards.
I think 'end' can be used in Python too:
- You need to define a dummy variable 'end'
- It's not enforced nor checked by the language, it's only to aid
readability, so ends may be placed incorrectly or left out
- Multple ends on one line need a comma separator:
end, end, end
- No one actually does this so it can't solve any of the problems
people might have with indentation