Symbol pollution non-issue.



You know I was just thinking about this whole non-issue that seems to irk some
people that if you misspell some symbol in your REPL, it gets interned and then
stays there forever until you manually scrub it away. I know that Clojure
obsesses over this also: it has a way by which such symbols are treated as
garbage.

What if packages simply used weak pointers for hanging on to symbols? So, come
garbage collection time, if the only reference to a symbol is via its
registration in the package system, it disappears.

If you call (intern "FOO" some-package), ignore the return value, and then the
next time you call (intern "FOO" some-package), you may get a different object.
However, sucha program has no way to tell that it got a different object; it
has no reference to the previously returned symbol to be able to make a
comparison, and if it does retain that reference, then doing so ensures that
the same symbol is returned.

It's a change in behavior for a program which interns a symbol, discards the
reference and then performs a FIND-SYMBOL to check whether the symbol is still
in the package. It may or may not be.

It seems as if DEFPACKAGE breaks because DEFPACKAGE is used to introduce a
bunch of symbols. The weakness could be set up on a per symbol basis. For
instance exported symbols could be normal references, protected from lapsing
under gc.

Shadowing definitions pose another problem. We sometimes make visible one
package inside another package, but then shadow some selectged symbols.
The shadowing symbols are often internal, and so not protected from lapsing by
the above rule. Solution: the symbols which are in the shadow symbol list of a
package are also protected from lapsing.

The principle is to separate "semantic garbage" symbols in a package,
from ones that are deliberate installed there by programmer intent.

Thoughts?
.



Relevant Pages

  • RE: Duplicate name error after copying task/ VS_ISCORRUPT
    ... What you have to do is copy the assemblies that you want to reference ... Dim oApp As New Application, ... Dim oExec As Executable ... ' Get package path ...
    (microsoft.public.sqlserver.dts)
  • Re: capturing the current package
    ... INTERN below with no second argument would be sufficient. ... sure that they end up in the right package. ... the source above my code that uses MAKE-SYMBOL*, ... in FOO, no matter whether MAKE-SYMBOL% was called in a macro ...
    (comp.lang.lisp)
  • Re: Symbols - when are they garbage collected?
    ... home package is often considered to be interning it (certainly it is ... I agree that the CL function INTERN does not do this. ... string as its primary input, ... among Lisp practitioners. ...
    (comp.lang.lisp)
  • Error 713
    ... and include a reference to the Msdbrptr.dll ... This file is listed as Microsoft Data Report Designer v6.0 in the ... Manually include the Msdbrptr.dll file in the Package and ... <windows system>\MSDBRPTR.DLL ...
    (microsoft.public.vb.controls)
  • capturing the current package
    ... an intern them in the package that was active at read time. ... INTERN below with no second argument would be sufficient. ... no matter whether MAKE-SYMBOL% was called in a macro expansion or ... "Build a symbol by concatenating each element of ARGS, ...
    (comp.lang.lisp)