[FIX] Re: bug in Array2D's rowAndColumnValuesDo: ?

Doug Way dway at riskmetrics.com
Fri Mar 22 17:53:45 UTC 2002


Yes, that is a bug, and your fix looks correct.  Array2D doesn't seem to be used much (at least it's not used in the base image), so that may be why the bug hasn't been noticed.

I've attached the fix as a proper changeset.

- Doug Way
  dway at riskmetrics.com


Evan Martin wrote:
> 
> I was recently introduced to Squeak as a project in a CS class
> (http://www.cs.washington.edu/341 -- programming languages).
> 
> I used the Array2D class in one of my projects, and encounted a small
> problem.  The following simple code causes an error in Squeak within the
> Array2D's method rowAndColumnValuesDo:
> 
>   a _ Array2D width: 10 height: 5. "width must be greater than height"
>   a rowAndColumnValuesDo: [ :row :col :value | Transcript show: value. ].
> 
> Some digging revealed that the rowAndColumnValuesDo: method incorrectly
> calls
>   self at: row at: col
> while the at:at: method is documented as returning the element at x, y.
> Unless my conception of the coordinate system is wrong, row corresponds
> to the y coordinate, so the proper code in rowAndColumnValuesDo: should
> be
>   self at: col at: row
> 
> (I'm not on the list, so feel free to CC me any responses.  I'm also
> pretty new to Squeak, so I apologize in advance if I mangled some
> terminology / reported something that's already well-known / did
> something else wrong.)
> 
> --
>       Evan Martin
> martine at cs.washington.edu
>   http://neugierig.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Array2Dfix.1.cs.gz
Type: application/x-gzip
Size: 434 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020322/3b755a50/Array2Dfix.1.cs.bin


More information about the Squeak-dev mailing list