[squeak-dev] FakeClassPool adopt: Pouah !

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Jan 31 21:54:26 UTC 2011


FakeClassPool is a class copying temporarily classPool / sharedPool of
a target class.
The FakeClassPool is a way to pass states to the Compiler via a global
variable (Pouah !).
As such, it deserves a -1 raised to the power of an odd integer.
It is supposed to let the Compiler access the class / shared variables
of a class.

OK, but the compiler already has access to the class/shared variables
via the doitReceiver.
If the doitReceiver is set correctly, then the FakeClassPool
classPool/sharedPool are useless.

Eventually, a FakeClassPool could be used to obfuscate a real receiver
and replace it with a fake...
But where is it of any use ?
Can any grey beard remember ?
Can a billion of young neurons extricate a valuable usage by comparing
implementors of #selectedClass and of #doitReceiver ?

Anyway, If I would want my doitReceiver to be a Fake, I would
implement this feature in #doitReceiver. Wouldn't you?
Any other usage would be intentionnally obscure.

Indeed, it seems that a new FakeClassPool is used only when the
selectedClass is nil...
... which means that the only case when the class and shared pool of
the FakeClassPool are used is the case when they are nil!
I would thus tend to nuke the #adopt: message.
It would be a nice thing to kick out the whole class too.
But measuring the consequences are out of my reach for the few minutes
of Smalltalk left this evening.
It seems that simple to remove this freak, there must be a trap somewhere...
Any help appreciated.

Nicolas



More information about the Squeak-dev mailing list