[squeak-dev] A candidate for the "weirdest bug ever" award

Stéphane Rollandin lecteur at zogotounga.net
Tue Feb 23 22:21:42 UTC 2016


I have a nice one:

In (seemingly) any 5.0 image, with the latest Spur, type the following 
in a workspace and printIt a couple of time:


(1 to: 3) collect: [:i |
	m := ''.
	2 timesRepeat: [m := m,  ('1234' perform: #copyFrom:to: with: 2 with: 4)].
	m]


I get kind of randomly either #('234' '' '') or the correct #('234234' 
'234234' '234234'), or at times #('234234' '' '').


Attached is the same code, this time in a method. It is even funkier, 
since a common answer is then 'copyFrom:to:234', although I sometimes 
get '234234' ...



Stef

-------------- next part --------------
'From Squeak5.0 of 6 August 2015 [latest update: #15113] on 23 February 2016 at 11:17:27 pm'!
Object subclass: #Try
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'WTF'!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

Try class
	instanceVariableNames: ''!

!Try class methodsFor: 'as yet unclassified' stamp: 'spfa 2/23/2016 23:12'!
me

	| m |

	m := ''.
	2 timesRepeat: [m := m, ('1234' perform: #copyFrom:to: with: 2 with: 4)].
	m.

	^ m! !


More information about the Squeak-dev mailing list