Re: gtk2-perl / a script to help converting basic functions

goran kirra net writes:

if I do this:

sub x
  my $window = GTk2::Window->new;

the $window variable is unreferenced and might get GCed at any 
time (won't it)? 

AFAIK, Perl's GC collects variables as soon as their reference
counter goes down to 0.

It may be bad style to code thtat way but I don't  think I like 
the supprise of the window disappearing when a perl variable get 
garbage collected.

In my opinion, this is little surprise the first time you see it,
but good feature in the long term. And after all, since you lost
the last reference to $window, you won't be able to destroy or
hide this window forever.. and that is not what I consider a good
programming feature.

But anyway if all people are against that, of course..

Guillaume Cottenceau -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]