[Libre-soc-dev] brace-delimited vs. indentation-based languages

Jacob Lifshay programmerjake at gmail.com
Thu Sep 24 22:54:14 BST 2020


On Thu, Sep 24, 2020, 13:47 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> On Thu, Sep 24, 2020 at 9:09 PM Jacob Lifshay <programmerjake at gmail.com>
> wrote:
> >
> > On Thu, Sep 24, 2020, 12:55 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> > wrote:
> >
> > > On Thu, Sep 24, 2020 at 8:20 PM Cole Poirier <colepoirier at gmail.com>
> > > wrote:
> > > > Aha! Thank you. Working on gtkwave debugging of icache.py, and
> > > > comparing with icache.vhdl... It turns out the main state machine was
> > > > incorrectly indented one level too far in icache_miss()
> > >
> > > yeah took me about 5 passes through dcache.py / dcache.vhdl to spot
> > > things like that.  it's laborious and tedious, needs a lot of
> > > patience.
> > >
> >
> > Reasons why {} languages (like Rust) are better :)
>
> yyeah, they tend to get abused, with massive blocks of code that run
> on for pages and pages, with no hope of understanding it at a high
> level, at a glance.
>
> it's generally good practice to keep everything on one page (where
> practical) by calling functions that do sub-work.
>

Keeping functions small is important, but, even with small functions, I
have often mis-indented code when copying it around and I have to manually
correct that in Python, since the incorrect indentation is still a
syntactically valid program, so the auto-formatter won't fix it. In Rust
(or C/C++), all I have to do is type the keyboard shortcut to format the
code and it's all properly indented and nested since the braces are in the
right spot when I pasted the code.

Jacob

>


More information about the Libre-soc-dev mailing list