# Semantics of VALUE

**URL:** <https://www.ruby-forum.com/t/semantics-of-value/65007>\
**Category:** Ruby\
**Created:** [August 15, 2006, 5:23pm UTC](https://www.ruby-forum.com/t/semantics-of-value/65007 "2006-08-15T17:23:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [August 15, 2006, 5:23pm UTC](https://www.ruby-forum.com/t/semantics-of-value/65007/1 "2006-08-15T17:23:52Z")

</div>

First off, I’d like to check this observation with folks on the list:

VALUEs today in Ruby are (sometimes) pointers to objects, and since  
those objects don’t (today) move in memory, we can assume that they  
are invariant for the lifetime of the process.

If that is true today, then here’s an interesting implication:

In future implementations of Ruby where presumably Ruby objects will  
be managed by more sophisticated GC’s which _do_ move objects in  
memory when collecting, this will potentially impact the semantics of  
VALUE. What happens to existing C-based extensions which assume the  
current semantics of VALUE in a world where objects move?

In the CLR, we have a type called a GCHandle which lets us get a  
reference to an object that can be manipulated directly by unmanaged  
code - sometimes this can even involve pinning the object in memory  
for the lifetime of the GCHandle.

Are the semantics of VALUE doc’d somewhere?

Thanks  
-John

> **[John Lam's Blog](https://www.iunknown.com/)**
>
> Since 1997

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [August 15, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/semantics-of-value/65007/2 "2006-08-15T17:44:55Z")

</div>

On Aug 15, 2006, at 11:22 AM, John L. wrote:

> memory when collecting, this will potentially impact the semantics of  
> VALUE. What happens to existing C-based extensions which assume the  
> current semantics of VALUE in a world where objects move?

a VALUE won’t be a VALUE then anymore. I imagine the whole api would  
have to change.

> In the CLR, we have a type called a GCHandle which lets us get a  
> reference to an object that can be manipulated directly by unmanaged  
> code - sometimes this can even involve pinning the object in memory  
> for the lifetime of the GCHandle.
> 
> Are the semantics of VALUE doc’d somewhere?

There’s README.EXT

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [August 16, 2006, 3:16am UTC](https://www.ruby-forum.com/t/semantics-of-value/65007/3 "2006-08-16T03:16:13Z")

</div>

Thanks, Logan!

-John
