[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Semantics of VALUE

John Lam

8/15/2006 3:22:00 PM

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
http://www.iu...

2 Answers

Logan Capaldo

8/15/2006 3:42:00 PM

0


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

> 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?
>

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

> Thanks
> -John
> http://www.iu...
>


John Lam

8/16/2006 1:14:00 AM

0

Thanks, Logan!

-John

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