Re: Larry Wall, on Tcl



On Dec 11, 3:32 pm, "Donal K. Fellows" <donal.k.fell...@xxxxxxxxx>
wrote:
tom.rmadilo wrote:
Donal's example below is a good example of how easy it is to write an
intelligent garbage collection routine.

No, it's Resource Allocation Is Initialization, a resource management
strategy developed originally in C++ that's trivial to adapt.

Good to know the technical term. Resource management gets right at the
heart
of the matter with Tcl. Maybe I have a simple view, but if you manage
your
resources (chans, memory, handles) correctly, you might not have too
much
garbage to collect. In most of my code, each namespace deals with a
particular set of data and the namespace has an [init] command.
Correct
operation would call this at the beginning of a particular chunk of
work and
potentially register cleanup:

namespace eval ::twt::db::handle {

variable initialized 0
variable ids
}

# First time a db handle is needed for a conn:
proc ::twt::db::handle::init { } {

ns_atclose ::twt::db::handle::reset
variable initialized 1
variable ids

array unset ids
}

proc ::twt::db::handle::reset { } {

variable initialized
variable ids

foreach id [array names ids] {
set pool [lindex $ids($id) 3]
set dataSource [lindex $ids($id) 1]
::twt::db::datasource::addPool $dataSource $pool
}

array unset ids
set initialized 0
}

So this namespace manages an array 'ids'. Now the user can use the
commands in
this namespace and not worry about initialization and resource
management.

Of course there are several other layers below this where the actual
resources are managed. This code just gets an exclusive reference to a
resource and makes sure it gets returned at the end of the work cycle.
This is kind of like how a public library works. You check out a book,
the library records the fact and relies on you to return it on time.
But in case that doesn't work out, they have ways of dealing with the
situation because they have a record of what was supposed to happen.
.



Relevant Pages

  • Re: Where is "paragraph #9"
    ... be held accountable for permit non-compliance and resource damage. ... I believe that the objectives set for the overall management of the ... Incident Management Team, Forest and cooperating agencies. ...
    (alt.gathering.rainbow)
  • Re: Where is "paragraph #9"
    ... be held accountable for permit non-compliance and resource damage. ... I believe that the objectives set for the overall management of the ... Incident Management Team, Forest and cooperating agencies. ... Mapping Social Change: A Visualization Method Used in the Monongahela ...
    (alt.gathering.rainbow)
  • Re: Resource Allocation Issue
    ... etc - of project management are far more important than any software you ... > where all the resource can be identify via a head count. ... >> qualified to do the job, their maximum allocation is 700%. ... >> allocate the Network Services resource to the task at 400%. ...
    (microsoft.public.project)
  • Re: Resource Allocation Issue
    ... > managerial soft skills - organizational, political, requirements ... > etc - of project management are far more important than any software you ... > they plan ... >> where all the resource can be identify via a head count. ...
    (microsoft.public.project)
  • Re: Resource allocation across multiple projects
    ... the specific breakdown on hours and time ... overallocated because I have left the resource units at 100%. ... contracts that know very little about project management. ... fellow MVP, Mike Glen's series on Project lessons and techniques. ...
    (microsoft.public.project)