Read only objects

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

Read only objects

Carl Gundel-2
The following information in the documentation about read only objects is a bit sparse.  Is there an article somewhere that explains better the proper use of the markReadOnly: method?
 
Thanks,
 
-Carl
 
Read-only objects
Pointer, byte, word, and long objects can be marked read-only. A read-only object cannot be stored into by Smalltalk.
The following methods relate to read-only objects:
markReadOnly: aBoolean
If aBoolean is true, marks the receiver as read-only. If aBoolean is false, marks the receiver as read-write. Answers true if the receiver is now read-only, false if the receiver is now read-write.
isReadOnly
Answers true if the receiver is read-only, false if not.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Read only objects

Richard Sargent
Administrator
On Friday, November 14, 2014 8:11:06 AM UTC-8, Carl Gundel wrote:
The following information in the documentation about read only objects is a bit sparse.  Is there an article somewhere that explains better the proper use of the markReadOnly: method?

Hi Carl,

The explanation may not be very clear. It means that the references held by the object's instance variables cannot be changed to reference different objects (and similarly, byte, word, and long objects cannot have their "instance variable" equivalents altered).

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Read only objects

Carl Gundel-2
Thanks Richard,
 
Do you know if the VA Smalltalk tools require adherence to this protocol?  If I am importing code that implements isReadOnly for a different purpose but do not reply the existing read only functionality in my application am I going to run into trouble?
 
Thanks,
 
-Carl

On Friday, November 14, 2014 4:32:03 PM UTC-5, Richard Sargent wrote:
On Friday, November 14, 2014 8:11:06 AM UTC-8, Carl Gundel wrote:
The following information in the documentation about read only objects is a bit sparse.  Is there an article somewhere that explains better the proper use of the markReadOnly: method?

Hi Carl,

The explanation may not be very clear. It means that the references held by the object's instance variables cannot be changed to reference different objects (and similarly, byte, word, and long objects cannot have their "instance variable" equivalents altered).

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Read only objects

Richard Sargent
Administrator
On Tuesday, November 18, 2014 7:13:24 AM UTC-8, Carl Gundel wrote:
Do you know if the VA Smalltalk tools require adherence to this protocol?  If I am importing code that implements isReadOnly for a different purpose but do not reply the existing read only functionality in my application am I going to run into trouble?

I think you should be OK. As far as I understand, the built-in read-only functionality works at the level of the VM, not the tools. That is, when you mark it read-only, the VM sets a flag in the object (header?). The VM then detects any attempt to store values into the object. Look at Object>>#at:put: for an example.
 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.