osdir.com


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

Scala considering significant indentation like Python


On 05/22/2017 12:13 PM, Michael Torrie wrote:
> On 05/22/2017 07:59 AM, Jussi Piitulainen wrote:
>> 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
>>
>>                  end
>>              end
>>          end
>>      end
>> end,
>>
>> 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.
>
> Kind of reminds me of LISP.  Lots of closing parenths, and often then
> just all get stuck together on a long.  But I guess that's why they
> invented paren matching shortcuts in editors.  To make it easy to see if
> you have them matched up.  This works with braces too.  Perhaps there is
> a plugin for Vim to jump back and forth between the beginning and end of
> a blog?  Wouldn't be too hard to just look at indent.

It's built-in, no plug-in necessary.

I still find white-space indentation easier to read, though.  Is that block 20 lines down inside or outside the above 
if/for/while?  Just put your cursor on it and go straight down and you'll find out.  Not so easy if the braces aren't 
lined up (at least for me).

--
~Ethan~