[libre-riscv-dev] mypy type annotations for nmigen

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Mar 13 05:11:57 GMT 2019


On Wed, Mar 13, 2019 at 4:55 AM Jacob Lifshay <programmerjake at gmail.com>
wrote:

> I created some type annotations for nmigen:
>
> https://salsa.debian.org/Kazan-team/simple-barrel-processor/tree/master/mypy_stubs/nmigen
>
> to use, add mypy.ini and mypy_stubs to repo root and run mypy or use pyls
> (python language server) with pyls-mypy
>
> If we're going to use this much, we should put the nmigen type annotations
> in a separate repo so it's easier to update across all users.
>

 i'd like to understand the benefits, first.  the separation seems like a
significant disadvantage, forcing people to write large amounts of
unnecessary code (the static typing) where, ordinarily, the code (dynamic
code) would be compact and minimal, and unit tests - which are an absolute
essential prerequisite - will catch errors and provide confidence in
correctness.

 i appreciate that you're used to strongly-typed languages (i started out
with c / c++), i'd like to know that there is an *actual* demonstrable
benefit, before resources are committed.

 specifically: if the typing catches 0.5% of bugs (bugs which are caught
anyway through comprehensive unit tests) yet adds 40% extra in development
time, that's not a benefit, it's a very strong case *not* to spend the time
(and money).

 if on the other hand it can be demonstrated that static typing catches 80%
more bugs, for only requiring 10% of extra development effort, or it
*reduces* the amount of code needed to be written, that's a clear benefit.

 as i explained in the previous message: given that we are using nmigen,
and that nmigen is itself not using static typing, the benefits are not
clear.

can you demonstrate *clear* benefits for the effort that is projected to be
expended, or demonstrate that the effort to be expended is minimal and
effective?

l.


More information about the libre-riscv-dev mailing list