Compile Time Constants

Eric Arseneau eat at huv.com
Fri Jun 16 22:01:03 UTC 2000


Has there been any thought of adding compile time constants to Squeak ?  I
find them very useful for obvious optimizations, as well as documenting code
in a more readable fashion.

In VA, I normally use expressions like
	^number bitAnd: ##((2 raisedToInteger: 16) - 1)
But in Squeak I have to change things like this to
	^number bitAnd: 65535 "(2 raisedToInteger: 16) - 1, 16rFFFF - 1"

As well, with the compile time constants, I can do away with a lot of Class
variables I would normally use to cache information.  Which also gets rid of
init code and reset code.

my 2 cents.

PS: I will be looking into what it would take to add some of the things I've
mentioned lately.  I'm just wondering what others are thinking.  It should
be easy to add ByteArray literals and CTCs.  The only issue is what the
syntax of the CTC would look like.  The VA one leaves something to be
desired, but it kinda works if you think of Symbols using # (maybe not ;->





More information about the Squeak-dev mailing list