Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8597225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:51:57+00:00 2026-06-12T00:51:57+00:00

Is there any standard way to create a transient class in CLOS; that is,

  • 0

Is there any standard way to create a transient class in CLOS; that is, a class which can be GC’d after all its instances are dead?

In SBCL, I tried (setf test (defclass #:foo () ())), i.e. using an uninterned symbol under the assumption that it would normally only be the class’ name which caused the class to be retained by the GC, but installing a SBCL finalization function on that class and then setting the symbol value of TEST to NIL shows that the class is never GC’d, no matter how many times I run (gc :full t). Which leaves me wondering if it’s possible, and if so, how.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:51:59+00:00Added an answer on June 12, 2026 at 12:51 am

    It does not matter that the class name, a symbol, is not interned in a package. FIND-CLASS will find the class by looking at some internal registry data structure. Clozure Common Lisp uses for example a normal hash table CCL::%FIND-CLASSES%.

    There is no standard way. The Common Lisp standard provides no mechanism. Typically a CLOS implementation will want to provide a list of all subclasses of a certain class. For that it needs a reference from a class to its subclasses. It is not specified that this should be a weak reference. For example CLISP implements it as a weak references, other Common Lisp implementations may not.

    Sketch of a solution:

    • So in a finalizer you would need calls to REMOVE-DIRECT-SUBCLASS (in what package that function may be, often in package CLOS) to remove the class from its superclasses.

    • You also need to call (setf (find-class 'my-class-to-be-removed) nil).

    • You also better look that the class does not have subclasses itself.

    So you may be able to build something using the widely supported MOP and implementation specific finalizers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any standard way of debugging Javascript on a webpage that's being accessed
Is there any standard way to route all Key events from the control A
Is there any way to start foobar.js WSH-script in order that standard Task Manager
Is there any standard way to create drop-down menu from QLineEdit without QCompleter? For
Is there any more or less standard way to specify a route that would
Is there any way to create a function/callable object that inherits properties from another
Is there any way to create a function with a real name that's determined
Is there any way that criteria for queries can be built on a remote
Is there any standard way to re-create the buttons seen when group text messaging?
Is there any standard way of implementing some sort of a write-through buffer for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.