Compilers with hooks
I have been thinking on type safety and the excellent job that compilers do. Without letting you assume things let me state it clearly - one job compilers do well is helping us write 'correct' software by verifying type usage. This means that, if you define a type and later use that type then the compilers verifies whether all usage is conformant to the definition.
What is so great about this - everyone knows this? I think that tells me something about my job as a mature programmer. I should write code that checks code - help other programmers - by simply shouting every time a rule or practice has been violated.
I am thinking in the lines of being able to write java code that can be then plugged into the compilation process in order to verify applications within context. So each product team or company can then apply their rules and practices that simply shout on violation. The programmers are then supposed to just go ahead and correct code to get quietness.
I am interested in dynamic typing and one of the issues in dynamic typing is that the functional type of the instance is not its static type but is separate and distinct. So each object has functional type information. All this is pretty well known. I would like to envision a mechanism of verifying usage of objects even when their type is attached at instance level (runtime).
To simplify the problem in static typing all usage of objects of class C have to be verified against definition in C. In dynamic typing objects now have a static type of D (the dynamic type def) and then their functional type has to attach to each of these objects in order to verify their usage. If this can be done we then catch a lot of problems associated with using dynamic types and dynamic typing is useful in certain application problems. Application Configuration and XML parsing are two examples.


0 Comments:
Post a Comment
<< Home