I am reading/thinking about pluggable types. I am interested in this, because I'd like to have customized, project-specific pluggable type systems.
C++ supports 'const' modifier for methods. These are methods declared with 'const' modifier. Such methods can only be called on variables declared as 'const'. Also, const methods can neither modify instance variables nor call non-const methods. Now, if we add a method annotation @ReadOnly and develop a type checker for that? i.e., an javac plug-in that validates that @ReadOnly methods do not assign to instance variables and do not call other non-@ReadOnly methods. Sometimes, we may want to modify few instance fields in @ReadOnly methods (may be "cache" fields for computed-read-only-state). We may add a field annotation called @Mutable to mirror C++ mutable keyword.
Non blocking methods are methods that
Now, there is one problem though. With pluggable types, there is going to be multiple type systems -- each possibly requiring the source to be annotated with different annotations. The problem is that most programs use huge third party and/or "platform" API (for eg. JDK API). These APIs will not have the new annotations -- and it is not feasible to annotate pre-existing, possibly "binary only" APIs. I am not sure this problem is due to the examples I've taken -- or that type systems would require "global" changes? With the single type system built into the language, there is one type system used by all programs and so there is no problem there. May be, is it time for me to read more about StrongTalk's type checker?
Posted by eu on February 21, 2006 at 11:56 AM IST #