I may be wrong, but I think that @alexeypetrushin complains that the compiler did not catch the error at compile time, but only at runtime.
Using OOP, the problem would not occur as the field `todo` would be only visible in the subclass. Here, detecting the error is possible but will require some improvement in the compiler.