[squeak-dev] [BUG] Issue with Matrix in instance variable

karl ramberg karlramberg at gmail.com
Tue Feb 18 20:59:25 UTC 2020


Hi,
I have this simple class TesterClass new.
Doit  in Workspace: TesterClass inspect.
The grid instance variable is initialized according to initialize method.
I doit in inspector: self fillGrid.
The grid matrix is now filled with all 9.
As expected.

Now doit in Workspace: TesterClass new inspect
The grid is all 9.

I think the issue is in
Matrix class>>rows: columns: contents:
rows: rows columns: columns contents: contents
^super new rows: rows columns: columns contents: contents

Matrix class overrides new so I think there is a conflict

Best,
Karl





'From Squeak5.3alpha of 23 October 2019 [latest update: #19139] on 18
February 2020 at 9:22:56 pm'!
Object subclass: #TesterClass
instanceVariableNames: 'grid'
classVariableNames: ''
poolDictionaries: ''
category: 'MyTestStuff'!

!TesterClass methodsFor: 'as yet unclassified' stamp: 'kfr 2/18/2020 21:21'!
fillGrid
grid atAllPut: 9! !

!TesterClass methodsFor: 'as yet unclassified' stamp: 'kfr 2/18/2020 21:18'!
initialize
super initialize.
grid := Matrix rows: 3 columns: 3 contents: #(
5 3 0
6 0 0
0 9 8 )! !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200218/81c8d180/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TesterClass.kfr.1.cs
Type: application/octet-stream
Size: 526 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200218/81c8d180/attachment.obj>


More information about the Squeak-dev mailing list