[GOODIE] Some code and advice to find a problem with pre-3.7 code

goran.krampe at bluefish.se goran.krampe at bluefish.se
Fri Mar 4 15:24:06 UTC 2005


Hi people!

This little 'goodie' is a hack for helping people detect a change in the
Compiler that Avi (cough) introduced back in 3.7 (don't have the update
number handy). Anyway, the problem is that the Compiled was changed so
that #(true false nil) evaluates to an array with those objects, and not
Symbols. To get symbols you now need to write #(#true #false #nil).

Now, how this came into the image without any of the methods that it
affects being tended to - I am not sure. :) In 3.8 I have tried hard to
fix all methods that are affected that haven't been fixed by other
people, including FFI.

But the issue remains for all code out there that wish to be ported from
3.6 into 3.8 or 3.7. This changeset is a hack, so only install it for
helping with this issue - I don't think it has any real problems but it
does change a few low level classes. :) Also read the preamble carefully
- there are some doits there that you can use.

And no, I will not listen to critique about this changeset etc, feel
free to use it or just ignore it.
But don't say we didn't try to help. :)

And with that I am dropping this issue, enough time wasted already. ;)

regards, Göran

from preamble:

"Change Set:		compilerWarnings-gk
Date:			4 March 2005
Author:			Göran Krampe

This changeset creates a little ugly mechanism for Compiler warnings,
which of course is debatable - but it can be used to detect the recent
#(nil true false) issue so I am posting it anyway.

The issue is that from 3.7 an array literal like above will end up
containing true, false and nil - not #true, #false and #nil.

The postscript creates a new preference compilerWarnings which you can
turn off. Use this mechanism to detect issues in your code using for
example:

	Smalltalk allClassesDo: [:c | c compileAll].

...or perhaps this that I think would recompile a certain package
(Avi?):

	(PackageInfo named: 'Monticello') classes do: [:c | c compileAll].
	(PackageInfo named: 'Monticello') extensionMethods
		do: [:mr | mr actualClass recompile: mr methodSymbol from: mr
actualClass]

This changeset only adds the warning of array literals with true, false
or nil in them. But methods dealing with an array expecting them to have
symbols would also be break and one way of possibly finding such methods
would be to if they are referencing #true, #false or #nil. This lets you
browse all those in your image:
 
| suspects |
suspects _ Set new.
suspects addAll: (self systemNavigation allCallsOn: #true);
	addAll: (self systemNavigation allCallsOn: #false);
	addAll: (self systemNavigation allCallsOn: #nil).
self systemNavigation browseMessageList: suspects name: 'Senders of
#true, #false or #nil' autoSelect: nil

Finally there may be other methods breaking, but this is the best we can
do. :)
"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compilerWarnings-gk.cs.gz
Type: application/octet-stream
Size: 2259 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050304/a432c90d/compilerWarnings-gk.cs.obj


More information about the Squeak-dev mailing list