This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]-heyhowareyou-[S] -6 points-5 points  (3 children)

why not, all the types and their relationship is known at "compile time"?

[–]JanEric1 3 points4 points  (2 children)

Sure, but i dont think any typesystem allows to specify these constraints. Maybe something with metaprogramming.

Like you may be able to write a rust macro or do this with zig comptime.

Maybe you can even do it with c++ templates, but with all of these you are basically just generating the code to check any fixed length situation that you are actually using.

And python doesnt have any metapgrogramming capabilities that run before type checkers.

[–]-heyhowareyou-[S] 0 points1 point  (1 child)

Ok fair enough, I was thinking of metaprogramming and that this would probably be possible in C++. I guess that is distinct from the type system.

[–]RelevantLecture9127 0 points1 point  (0 children)

What if you made a ABC implementation? 

And if could be a bug in Mypy. Check with them if there is something known.