Attempt to modify invariant object, anArray

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Attempt to modify invariant object, anArray

GLASS mailing list
Hi guys,

Quick email as I must leave now... I am trying to run this code:

tableSpec table do: [ :aRow |
| value |
value := (aRow at: 2) = 'L' ifTrue: [ 'Left' ] ifFalse: [ 'Right' ].
        aRow at: index put: value 
].

the 'aRow' array is as simple as anArray ('Price' , 'R', '', '') ...
Looks like a problem of passing the array as argument... 

The error I get is:

" ArgumentTypeError(AbstractException)>>_signalFromPrimitive: @5 line 15a ArgumentTypeError occurred (error 2031), reason:markWritten.b, Attempt to modify invariant object, anArray

I just don't get it.. grrr must run now..

Cheers, 



--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Attempt to modify invariant object, anArray

GLASS mailing list
Thank you guys..I was indeed making some default instances with this literal arrays..and this was the first time I have to edit those..

Thanks!

On Fri, Jun 3, 2016 at 8:46 PM, Richard Sargent <[hidden email]> wrote:
On Fri, Jun 3, 2016 at 1:30 PM, Mariano Martinez Peck via Glass <[hidden email]> wrote:
Hi guys,

Quick email as I must leave now... I am trying to run this code:

tableSpec table do: [ :aRow |
| value |
value := (aRow at: 2) = 'L' ifTrue: [ 'Left' ] ifFalse: [ 'Right' ].
        aRow at: index put: value 
].

the 'aRow' array is as simple as anArray ('Price' , 'R', '', '') ...
Looks like a problem of passing the array as argument... 

The error I get is:

" ArgumentTypeError(AbstractException)>>_signalFromPrimitive: @5 line 15a ArgumentTypeError occurred (error 2031), reason:markWritten.b, Attempt to modify invariant object, anArray

I just don't get it.. grrr must run now..

Hi Mariano,

Given what you have described, the most likely cause is passing in a literal array. That guess is further reinforced by using the name "tableSpec".
e.g.
#(
('Price', 'R', '', '')
('Quantity', 'R', '', '')
('Cost', 'R', '', '')
)

-- Richard


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass





--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Attempt to modify invariant object, anArray

GLASS mailing list

aRow is an array that was created as part of a compiled method. The error is preventing you from changing code by changing the literal array. You may want to #collect: copies of each row that are then modified. Then again the code seems to serve no purpose except perhaps if intended for data read from an external source; with real externally sourced data the error would not happen.

Paul Baumann

On Jun 3, 2016 8:09 PM, "Mariano Martinez Peck via Glass" <[hidden email]> wrote:
Thank you guys..I was indeed making some default instances with this literal arrays..and this was the first time I have to edit those..

Thanks!

On Fri, Jun 3, 2016 at 8:46 PM, Richard Sargent <[hidden email]> wrote:
On Fri, Jun 3, 2016 at 1:30 PM, Mariano Martinez Peck via Glass <[hidden email]> wrote:
Hi guys,

Quick email as I must leave now... I am trying to run this code:

tableSpec table do: [ :aRow |
| value |
value := (aRow at: 2) = 'L' ifTrue: [ 'Left' ] ifFalse: [ 'Right' ].
        aRow at: index put: value 
].

the 'aRow' array is as simple as anArray ('Price' , 'R', '', '') ...
Looks like a problem of passing the array as argument... 

The error I get is:

" ArgumentTypeError(AbstractException)>>_signalFromPrimitive: @5 line 15a ArgumentTypeError occurred (error 2031), reason:markWritten.b, Attempt to modify invariant object, anArray

I just don't get it.. grrr must run now..

Hi Mariano,

Given what you have described, the most likely cause is passing in a literal array. That guess is further reinforced by using the name "tableSpec".
e.g.
#(
('Price', 'R', '', '')
('Quantity', 'R', '', '')
('Cost', 'R', '', '')
)

-- Richard


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass





--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass