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

I think that it can sometimes be helpful to have some protective functions, as long as it is not excessive. It should not be mandatory and should not be too difficult to avoid. I program in C, and I do not use most of the warnings since they are excessive (in my opinion), but the warning about implicitly using a integer as a pointer is sensible (and should be an error) since you can easily explicitly override it (with the specific pointer type that you need) if that is really what you meant.

Tests are good regardless of what the programming languages tries to do, since not all bugs can be avoided by the programming language, and not all bugs should be avoided by the programming language. It should let you to write the program, instead of to stop you.

However, there are situations where due to the working of the implementation, there is no reasonable way to compile it when it specifies something which is then violated, or there might be certain extra things that may be required in the compiled code (making it bigger and/or slower in certain circumstances) when certain things are open. For example, consider if a different calling convention is needed for functions that can throw an exception (although in this case it should not require a try block if the function that calls it is also says it can throw an exception), or if some things in functions in a open class will need to be compiled in a special way to consider the possibility that other parts of the class will be overridden (both of these examples are hypothetical, I do not know whether or not any of this is actually true). It is also possible that certain optimizations are possible or not possible depending on if a class is open or something is nullable etc. Due to such things like that, specifying such features in the program might sometimes be necessary in order for the compiler to work correctly.



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

Search: