[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

_id2ref in finalize or how get object.var from class.finalize

andrey

12/15/2007 6:54:00 PM

Hi, all.

#!/usr/bin/ruby1.8

include ObjectSpace

class MyClass
attr_reader :var
def initialize(var)
@var = var
puts "from initialize: #{@var}"
define_finalizer(self, self.class.method(:finalize).to_proc)
end

def MyClass.finalize(object_id)
o = _id2ref(object_id)
puts "from finalize: #{o.var}"
end
end # class Storage

o = MyClass.new("The Value!")
exit 0

Why lines of a code after a call of function "_id2ref(object_id)" are
never carried out?

How it is possible to get access to variables or methods of a object
from a method of a class :finalize?

--
Andrew Nikitin


5 Answers

Nobuyoshi Nakada

12/16/2007 3:46:00 AM

0

Hi,

At Sun, 16 Dec 2007 03:53:49 +0900,
Andrey Nikitin wrote in [ruby-talk:283702]:
> def MyClass.finalize(object_id)
> o = _id2ref(object_id)
> puts "from finalize: #{o.var}"
> end

Finalizer is called after the object was disposed. So _id2ref
raises an exception.

> How it is possible to get access to variables or methods of a object
> from a method of a class :finalize?

It does not exist at that moment any more.

--
Nobu Nakada

TheInquirer

11/12/2013 1:34:00 AM

0

On 11/12/2013 8:43 AM, yansimon52 wrote:
> In their islamic communties...u see.mother will normally teach their just married daughter to secretly put some "voodoos" charm for her husband to drink...so tat husband wont go for other woman. Among rhose food stalls at geylang serai...popular stalls encounter ppl secretly throw 'voodoos' charm at under their serving table...due to envy...why his biz is better than mine. This is what happening in the world of the islamic way of life.
> In fandi case...where his wife wendy suffering from a mysterious stroke at such a young age...who to blame?..another envy thing happening among them.
> Blame it on their so called story book which could churn out alot of voodoos activities for them to digest slowly.
> Worst is...if fandi is a soft hearted guy n after facing alot of personal problem...he then thot of ...maybe got to be pious tis time...got to.ask allah for help...so he then perform more night prayers.....haloooo u r making thing worst for yourself....cos your kind spiritual self will 'crash' with those forces from the darkside.cos...forces from the darkside do not really welcome kind hearted or emotional ppl like u. .so making u sink deeper into a hole with no turning back. Forces frm the darkside simply love to welcome thos hustlers, conman or ah longs..
> Dont tell me tar fandiis not aware this....it takes all kind of ppl to form tis world...some r kind heart or emotional...some are just bastard...ruthless..n hustlers....that is why...God created the 2 environmental forces where its elements will suit each individual....so as a man..we must have the knowkedge to understand all these...in order to make thing right for u and yr family or ppl around u.
> In the first place...when once wendy suffer a stroke...that time fandi was a well to do man...he shld sent wendy to stay oversea for awhile and oso changed hse..


why doesn't the Allah send lightning to zap all the evil voodoo people?

worse still, if there is terrorist use the name of Allah, why doesn't
the Allah send lightning to zap all the terrorist?

it turns out that the "anti-terrorist" USA has become itself a
terrorist, causing trouble internally and all over the world, economic
and militarily ... why doesn't the Allah send lightning to zap and
destroy yoU-aSs-Aey ?

yansimon52

11/12/2013 3:03:00 AM

0

Haloooo bro...again u talk as if allah is the one calling the shot. Haloooo allah is just one of those "diety/angel /lost soul" whom we human can communicate with....like tos taoist medium communicating with dieties all the time in taoist temple, nightly.

Wat so great abt allah?

Worldly affair...doesnt concern with the spiritual
world.
Why tis phrase "" forgiving is divine" is being used?
Spiritual beings...regardless of whether its a diety...its allah...its angel...its demon.its lost soul..its satan..these spiritual beings r considered as "divine".....n why we associate the word "divine" with the word "forgiving".
No matter how cruel u are...no matter how kind u are...no matter how ruthless u are...when u set up an altar to pray to these divine spiritual beings.....these divine beings "allowed" u to pray to them...in another word...indirectly they "forgive" u.
U show me....which spiritual being...when u bow n pray to them....he tell u to "fuck off"....lol...lol

TheInquirer

11/12/2013 7:27:00 AM

0

On 11/12/2013 11:02 AM, yansimon52 wrote:
> Haloooo bro...again u talk as if allah is the one calling the shot.

just asking only. why so angry?



Haloooo allah is just one of those "diety/angel /lost soul" whom we
human can communicate with
.....like tos taoist medium communicating with dieties all the time in
taoist temple, nightly.

you mean it's like using different apps e.g. Twitter, Yahoo Messager,
Fakebook? can I download Islamism, Taoism, Christianism, Buddhism and
use all of them?


> Wat so great abt allah?
>
> Worldly affair...doesnt concern with the spiritual
> world.

so that's the reason why during World War II, when Hitter hit the world
and created havoc, nobody from above intervened? Same for current
events like financial crisis, USA bullying of Arab countries, shooting
of innocent people by mad gunmen, etc etc?


> Why tis phrase "" forgiving is divine" is being used?
> Spiritual beings...regardless of whether its a diety...its allah...its angel...its demon.its lost soul..its satan..these spiritual beings r considered as "divine".....n why we associate the word "divine" with the word "forgiving".

i heard that "divine" means "from the vine". some of the grapes are
really sour and bitter. warum? (why?)


> No matter how cruel u are...no matter how kind u are...no matter how ruthless u are...when u set up an altar to pray to these divine spiritual beings....these divine beings "allowed" u to pray to them...in another word...indirectly they "forgive" u.
> U show me....which spiritual being...when u bow n pray to them....he tell u to "fuck off"....lol...lol

do they need us to kiss their asses, or do they not? or is it that
human beings _think_ that they need us to kiss their ass?

yansimon52

11/13/2013 3:13:00 PM

0

I love u la...why shld i get angry!!!

Not frm d grape vine...its frm lychee vine....lol...