[#536] SEVG in bignum.c:505... — Sean Chittenden <sean@...>
$ ruby -e 'p [].to_s.strip.to_i'
5 messages
2002/10/13
[#537] darwin shared library patch — Eric Melville <eric@...>
In Darwin, the preferred way to build shared libraries is with two level
9 messages
2002/10/13
[#539] Re: darwin shared library patch
— "Akinori MUSHA" <knu@...>
2002/10/13
Hi,
[#544] Re: darwin shared library patch
— Eric Melville <eric@...>
2002/10/16
> The patch seems to make ENV[]= coredump.
[#546] Re: darwin shared library patch
— "Akinori MUSHA" <knu@...>
2002/10/16
At Thu, 17 Oct 2002 01:41:49 +0900,
[#541] Patch for MacOS X dln.c — Luc B駘anger <belanglu@...>
I have a patch for the dynamic linker in MacOS X, which permit to load
7 messages
2002/10/13
Id question
From:
Torsten Rer <torsten.rueger@...>
Date:
2002-10-04 07:39:08 UTC
List:
ruby-core #522
Moi,
so what I'm trying to achieve is probably best explained by code.
Purple.add is a function that takes any object, saves it and returns a
unique database id. Purple.get takes such an id and returns an object
that is data-wise quivalent to the original.
What I'm trying to do boils down to returning the _same_ (===) object
that was put in, if it's still around. For that I need some kind of id
system. But first, in code:
a = "rubies can have a shade of purple"
b = [ a ]
id_a = Purple.add a
id_b = Purple.add b
// commit ... ...time passing ... id's get passed around the net and
come back, then ..
aa = Purple.get id_a
bb = Purple.get id_b
aa === bb.first // that's what I want, just == I can already do, but
for graphs that's no good.
So I looked at the ruby id related functions. Is it true
-- Basic types (symbols, strings) have id's that count up, the id is
never reused
-- objects use their address as base for id
-- thus if an object goes out of scope and the memory is reused, i can
later have a different object with the same id
And how are id's for more complex, but builtin types done ? I mean
array, hash, bignum, regex ...
So coming back to my problem, does it sound like a solution that in add,
i add my db_id to objects (**), and store a mapping of the ruby_id
against my db_id for basic types. And then in the get, I check if the
object has a db_id, in which case I have to do nothing, and for basic
types I check my mapping and return what I find, or I instantiate the
say string, and store the mapping again. Does that sound reasonable ?
Cheers
Torsten