[libre-riscv-dev] nmigen frustrations make me want Rust

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Mar 17 14:14:20 GMT 2019


Example of the polymorphic benefits of python which I plan to exploit is in
the pipeline Stage API. Use m.d.comb += self.idata.eq(self.idata) and if
odata is an object or a signal it does not matter.

The API requirement becomes that if it is an object then the eq function
must return a *list* of eq assignments of all of the signals within that
class instance that will get the assignment of the idata object signals
into odata.

Strong typing actually massively interferes with this type of flexibility
as it is unexpected and unanticipated legitimate *and desirable* behavior
that not even the authors of nmigen could have predicted, and strong typing
would prevent and prohibit unless explicitly envisaged, way, way in
advance, which is almost impossible and impractical.

This type of powerful shoot-yourself-in-the-foot capability of python is
just something that you need to put strict software engineering practices
in place and adhere to them no matter what.

15 years ago I genuinely used to think that unit tests were a total waste
of effort. Then for pyjamas (the python to javascript language translator)
we accumulated well over 20,000 of them and it was the only way that we
could safely make forward progress.

As a team we managed some really quite significant fundamental redesigns,
outputting completely different code, even with different performance
characteristics.

L.


-- 
---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68


More information about the libre-riscv-dev mailing list