Subject: Re: software "engineering" (again) (was Possible bug in ACL and Corman  Lisp?)
From: Erik Naggum <>
Date: Mon, 18 Feb 2002 09:20:43 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Software Scavenger
| But how likely is automatic garbage collection to survive?  Surely when
| computers can program themselves, they will eventually become
| sophisticated enough to use the lowest level machine code, optimizing it
| for each function, and won't be bothered by the relatively low mental
| overhead of keeping track of what memory needs to be freed when.

  The problem that garbage collection solves is not freeing memory, but
  that of keeping track of who owns an objects so the owner can free it
  when certain that no other users know about it.  Object-orientation a la
  C++ makes OOP stand for "Object Ownership Protocols".

  In effect, the system owns the object in garbage collected systems unless
  you go to some lengths to claim ownership yourself, such as by having a
  foreign function make a copy to assert its ownership in the C++ way.
  This means that there is no distinction between "owner" and "non-owner",
  which is such a problem in C++-like languages.  (Consequently, there is
  no problem in having multiple garbage collection schemes in operation at
  the same time.)

  If you receive an object from a function that is not guaranteed to create
  a new one just for you, you have to assume that it may be referenced
  elsewhere.  If you do pass an object to a function that is guaranteed not
  to keep a reference to it, you have to assume it does.  Since this stuff
  requires compile-time knowledge (promisees), the amount of declarations
  required to use some other allocation mechanism is probably not worth it
  in human terms, but if you know you are going to create and release an
  object in the same (controlling) function, the easiest way to deal with
  this is "resourcing", which should be available in all quality Common
  Lisp implementations, and which is a technique to manage your own pool of
  objects, probably using a weak vector (so free objects do not survive a
  garbage collection phase) to hold free objects from which you allocate if
  there is one available and to which you return objects when they would
  have become garbage.

  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.