On Jun 16, 2007, at 10:51 PM, Dan Amelang wrote:

> Anyone know how I can make a copy of a pepsi object?

Here's one cheap, cheerful and potentially dangerous (it assumes  
'self _sizeof' returns the correct value, which may not be true for  
objects that implement 'inline indexable fields') way to do it...

Object shallowCopy
[
     | _size clone |
     _size := self _sizeof.
     clone := self _vtable _alloc: _size.
     { memcpy(v_clone, v_self, (long)v__size); }.
     ^clone
]

Caveat emptor!

Cheers,
Ian

_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to