On Wed, 6 Dec 2000, Dan Sugalski wrote:
> > my $new_dog;
> > {
> > my $dog = new Dog;
> > $new_dog = \$dog;
> > }
>
> That would hoist the Dog reference into an outer level of scope--in this
> case the one containing $new_dog. Or so my thinking goes at the moment,
> though there may be (almost inevitably are) problems with that.
"hoist"? I thought this was a stack you were talking about. You're going
to do an O(n) operation on a stack every time a reference is passed out of
scope? What happens when two references diverge:
my $newDog1;
{
my $newDog2;
{
my $dog = new Dog;
$newDog2 = $newDog1 = \$dog;
}
$newDog1 = undef;
}
How does a non-refcounting scheme know that $newDog2 is the last ref to
$dog when the first block is done?
As far as claims about mark-and-sweep improving performance, I guess we'd
need a test implementation in order to find out. Considering the
non-deterministic character of many mark-and-sweep systems performance
testing can be a delicate matter.
-sam