Re: Larry Wall, on Tcl
- From: "tom.rmadilo" <tom.rmadilo@xxxxxxxxx>
- Date: Mon, 10 Dec 2007 18:34:08 -0800 (PST)
On Dec 10, 5:04 pm, Darren New <d...@xxxxxxxxxx> wrote:
Alan Anderson wrote:
Darren New <d...@xxxxxxxxxx> wrote:
Cameron Laird wrote:
EIAS isn't a good thing?It has its drawbacks. Like, no garbage collection of referenced objects.
What is a "referenced object" and why should I care?
Because garbage collection is good? Especially of external resources
like file handles? If everything is a string, you have no pointers, and
hence no garbage collection.
I write long-running, robust software in Tcl. It would be enhanced by
the ability to use OO features without mistakes leading to leaks, for
example.
I never could figure this out. I always assumed that if I didn't take
care to take out the garbage and also provide a clean slate for new
work, I was introducing potential unexplained behavior. I just fixed a
bug in this category today. I've never heard of an ideal garbage
collection system, so I assume that it is a black art, subject to a
lot of hand waving.
In Tcl, any object (variable, namespace, proc) with a name is a
pointer, if it is ultimately stored in a hash it must be a pointer
with a nice name in a limited scope.
But the idea that something must have a reference count that would
inform the need to garbage collect seems impossible in Tcl. If you
open a file and don't close it, it is still open. A namespace exists
until it is deleted. How do you count references on that?
So the first thing is to define what a non-referenced object would
look like. For many types of referenced objects, the only reasonable
idea (in Tcl) is to have an ownership relationship with a parent
object. When the parent object dies, so must the child objects. And
when parent objects are initialized or reinitialized, things are
cleaned up. This implies a controller above the level of the objects,
and if the controller fails, the entire system must fail and allow the
OS to do cleanup. So GC could be done with a registration process
which triggers on object exit, or you could use a centralized
registration with the controller. On some interval, the controller
will look at the list of registered objects. If the object exists,
nothing is done, otherwise the controller would destroy the child
objects.
I think there is more of a gap between ideal behavior and reality in
this area than in most because you must rely on some parallel or
separate mechanism to enforce cleanup, and require everyone to use the
conventions. And this is the problem. GC requires work, but usually
the offending code is the code which didn't do the work.
.
- Follow-Ups:
- Re: Larry Wall, on Tcl
- From: Donal K. Fellows
- Re: Larry Wall, on Tcl
- From: Uwe Klein
- Re: Larry Wall, on Tcl
- From: Darren New
- Re: Larry Wall, on Tcl
- References:
- Larry Wall, on Tcl
- From: Bryan Oakley
- Re: Larry Wall, on Tcl
- From: tom.rmadilo
- Re: Larry Wall, on Tcl
- From: Bryan Oakley
- Re: Larry Wall, on Tcl
- From: tom.rmadilo
- Re: Larry Wall, on Tcl
- From: Cameron Laird
- Re: Larry Wall, on Tcl
- From: Darren New
- Re: Larry Wall, on Tcl
- From: Alan Anderson
- Re: Larry Wall, on Tcl
- From: Darren New
- Larry Wall, on Tcl
- Prev by Date: Tcl-URL! - weekly Tcl news and links (Dec 11)
- Next by Date: Re: Larry Wall, on Tcl
- Previous by thread: Re: Larry Wall, on Tcl
- Next by thread: Re: Larry Wall, on Tcl
- Index(es):
Relevant Pages
|