Re:Cold Showers
by jacobsenscott on Monday June 20, 2022 @12:44AM
(#31806374)
> I don't need tests to check what methods or fields are on my types though.
You do though, because invariably people violate the LSP and just "throw Unimplemented" in the methods required by the interface they can't figure out how to implement. In other words all system are duck typed in reality.
Re:Cold Showers
by lijogdfljk on Monday June 20, 2022 @01:37PM
(#31813154)
I don't, though. If it compiles, it exists. Saying that a method might actually be a nuke is a bit besides the point. It could also contain a virus.
Not sure what typing system you're referring to, but it sounds very half-baked at best. I'm using Rust fwiw.
I cannot access any field or method that does not exist. Even dynamic traits are compile time enforced, but i think we can largely have this discussion around static dispatch.
You need the same tests from a typed system in a non-typed. You _don't_ need all the tests from a non-typed system in a typed system.
Writing tests to enforce types just hand-rolls a type system, in my experience.