Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Huh, I thought type annotations were unused at runtime. How can I enable runtime type checking?


Even Java, which introduced generic types long after the language itself had become standardized and popular, cannot keep generic type information after compilation due to backwards compatibility.

Don't quote me on it, but I believe C# doesn't have this problem.


But the compiler checks for this by default, so you'll get a warning unless you really break the type system.


There are libraries that do magic to do this. Annotations are accessible at runtime, so you can do things like add an implicit import hook that decorates every function or class with a decorator that validates the annotations.


You can't! Or, I guess you could do something hacky with the #!.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: