Are assignment to block variables is prohibited?

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

Are assignment to block variables is prohibited?

Stephane Ducasse-3
Hi

I know that method arg are read only and you cannot assign to them.
Now what is the status of block arguments?
Because some old code of plotmorph is breaking.

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Are assignment to block variables is prohibited?

Nicolai Hess-3-2
Yes. But there is a setting for the compiler to load/compile code with errors.

2017-09-14 20:46 GMT+02:00 Stephane Ducasse <[hidden email]>:
Hi

I know that method arg are read only and you cannot assign to them.
Now what is the status of block arguments?
Because some old code of plotmorph is breaking.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Are assignment to block variables is prohibited?

Nicolai Hess-3-2


2017-09-14 21:43 GMT+02:00 Nicolai Hess <[hidden email]>:
Yes. But there is a setting for the compiler to load/compile code with errors.


2017-09-14 20:46 GMT+02:00 Stephane Ducasse <[hidden email]>:
Hi

I know that method arg are read only and you cannot assign to them.
Now what is the status of block arguments?
Because some old code of plotmorph is breaking.

Stef



But using catalog, I can load plotmorph, even without enabling this setting.


Reply | Threaded
Open this post in threaded view
|

Re: Are assignment to block variables is prohibited?

Marcus Denker-4

On 14 Sep 2017, at 22:00, Nicolai Hess <[hidden email]> wrote:



2017-09-14 21:43 GMT+02:00 Nicolai Hess <[hidden email]>:
Yes. But there is a setting for the compiler to load/compile code with errors.


2017-09-14 20:46 GMT+02:00 Stephane Ducasse <[hidden email]>:
Hi

I know that method arg are read only and you cannot assign to them.
Now what is the status of block arguments?
Because some old code of plotmorph is breaking.

Stef



But using catalog, I can load plotmorph, even without enabling this setting.

OCStoreIntoReadOnlyVariableError checks if you are compiling interactively or not.

signal
compilationContext interactive
ifFalse: [ ^ self crTrace ].
^ super signal

This way old code load fine, but you are not allowed to create such code while
coding… and you have to fix code when recompiling a method interactively
that has an assignment to an argument.

Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Are assignment to block variables is prohibited?

Stephane Ducasse-3
In reply to this post by Nicolai Hess-3-2
Yes I checked again and I do not get why it is barking with mark load it.
I will look at the plotmorph code later.


On Thu, Sep 14, 2017 at 10:00 PM, Nicolai Hess <[hidden email]> wrote:

>
>
> 2017-09-14 21:43 GMT+02:00 Nicolai Hess <[hidden email]>:
>>
>> Yes. But there is a setting for the compiler to load/compile code with
>> errors.
>>
>>
>> 2017-09-14 20:46 GMT+02:00 Stephane Ducasse <[hidden email]>:
>>>
>>> Hi
>>>
>>> I know that method arg are read only and you cannot assign to them.
>>> Now what is the status of block arguments?
>>> Because some old code of plotmorph is breaking.
>>>
>>> Stef
>>>
>
>
> But using catalog, I can load plotmorph, even without enabling this setting.
>
>