digitalmars.D - version system: query-change lock idea
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (81/81) May 14 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Walter (1/1) May 14 2005 Yeah, I was thinking that too. You're right.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The current version/debug system has some undefined/unenforced corners. version(A){ pragma(msg, "everytime"); }else{ version=A; } The "everytime" message will always be displayed. version=A; version(A){ version=B; } version(B){ pragma(msg, "sometimes"); } version(A){ version=B; } version=A; version(B){ pragma(msg, "sometimes"); } The content of sample 3 is a reordered sample 2. Sample 2 displays the message whereas sample 3 displays nothing. I suggest a query-change lock mechanism to close those corners. The compiler has to ensure that re-evaluating a conditional - "version(A)" - will always have the same result. version(A){ pragma(msg, "A: true"); } version=A; // ***illegal, the status of A was changed*** version=A; version(A){ pragma(msg, "A: true"); } version=A; // ***legal, the status of A didn't change *** version=2; version(2){ pragma(msg, "level >= 2"); } version=3; // ***legal*** true: newLevel >= highestQuery true: highestQuery >= current level version=1; version(2){ pragma(msg, "level >= 2"); } version=3; // ***illegal*** true: newLevel >= highestQuery false: highestQuery >= currentLevel version=1; version(2){ pragma(msg, "level >= 2"); } version=0; // ***illegal*** false: newLevel >= highestQuery true: highestQuery >= currentLevel Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) iD8DBQFChkio3w+/yD4P9tIRAoCvAKCwFPw5SrEpAc0XXaq6yyU76Gy1GQCgpMrs M0sLKyNIqWi1iIEQ0G3qizE= =r5pg -----END PGP SIGNATURE-----
May 14 2005
Yeah, I was thinking that too. You're right.
May 14 2005