A
Austin Ziegler
I have a problem, and it's been bugging me for a while, so I thought
that I'd ask people that know a lot more about the internals of Ruby
than I do.
In PDF::Writer, I have a complex object graph. Its complexity is
mostly caused by the fact that all objects must know their parent
object. Maybe something like:
foo#35
bar#36 (@parent =3D foo#35, ...)
baz#37 (@parent =3D foo#35, ...)
When this graph gets roundtripped through Marshal, I might have:
foo#38
bar#39 (@parent =3D foo#35, ...)
baz#40 (@parent =3D foo#35, ...)
This means that there are now "odd" copies of at least the parent
(foo#35) around. This is something that *does* happen when
Transaction::Simple is called. Now, if I then add something else:
foo#38
bar#39 (@parent =3D foo#35, ...)
baz#40 (@parent =3D foo#35, ...)
bom#41 (@parent =3D foo#38, ...)
Obviously, this not only gets silly after a while, but it gets pretty
inefficient.
I want to fix Transaction::Simple so that the object graph is
*properly* reconstructed. That is, if I Marshal.dump the foo with
object ID 35, I don't mind if it's reconstituted as #38, but I want
"old" references to #35 reconstructed as references to #38.
How can I do that? Preferably, how can I do that without crawling the
object graph -- which would be extremely inefficient?
-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
that I'd ask people that know a lot more about the internals of Ruby
than I do.
In PDF::Writer, I have a complex object graph. Its complexity is
mostly caused by the fact that all objects must know their parent
object. Maybe something like:
foo#35
bar#36 (@parent =3D foo#35, ...)
baz#37 (@parent =3D foo#35, ...)
When this graph gets roundtripped through Marshal, I might have:
foo#38
bar#39 (@parent =3D foo#35, ...)
baz#40 (@parent =3D foo#35, ...)
This means that there are now "odd" copies of at least the parent
(foo#35) around. This is something that *does* happen when
Transaction::Simple is called. Now, if I then add something else:
foo#38
bar#39 (@parent =3D foo#35, ...)
baz#40 (@parent =3D foo#35, ...)
bom#41 (@parent =3D foo#38, ...)
Obviously, this not only gets silly after a while, but it gets pretty
inefficient.
I want to fix Transaction::Simple so that the object graph is
*properly* reconstructed. That is, if I Marshal.dump the foo with
object ID 35, I don't mind if it's reconstituted as #38, but I want
"old" references to #35 reconstructed as references to #38.
How can I do that? Preferably, how can I do that without crawling the
object graph -- which would be extremely inefficient?
-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)