Comment on use of VOLATILE in the JLS.?
>It is my opinion and my experience that inclusion >of VOLATILE in Java has lead to nothing but confusion >and bad coding practices. *Personally*, I completely agree. >ANYWAY, I think it would be of some value to include a >statement of where VOLATILE is and isn’t useful and >examples of same. In particular, that VOLATILE is almost >always the WRONG thing to use, and that programmers >should avoid it unless they have a VERY clear understanding >of the consequences. We might be able to squeeze something in. However, bear in mind that the primary purpose of the JLS is to specify the language semantics, not to teach people how to use it. [Some time after this exchange, the issue of the description of the memory model required by Java popped up led by Lea & Pugh. The gist of this is that a pile of details will be fixed AND VOLATILE will be given more adaquate semantics, making it POSSIBLE to use correctly. It will still be *VERY* difficult and should still be avoided.] ********************
Comment on use of VOLATILE in the JLS.?