Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Preventing a class from being instantiated

Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!nntp.cadvision.com!207.228.64.17.MISMATCH!not-for-mail
From: "Wade Humeniuk" <humen...@cadvision.com>
Newsgroups: comp.lang.lisp
Subject: Re: Preventing a class from being instantiated
Date: Wed, 28 Nov 2001 22:17:06 -0700
Organization: CADVision/PSINet
Lines: 19
Message-ID: <9u4gca$9qe$1@news3.cadvision.com>
References: <m3vgfu5mgo.fsf@kappa.unlambda.com> <9u4802$66q$1@news3.cadvision.com> <873d2yi5fq.fsf@orion.bln.pmsf.de>
NNTP-Posting-Host: h-209-91-69-186.gen.cadvision.com
X-Trace: news3.cadvision.com 1007011018 10062 209.91.69.186 (29 Nov 2001 05:16:58 GMT)
X-Complaints-To: news@cadvision.com
NNTP-Posting-Date: Thu, 29 Nov 2001 05:16:58 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

>
> That will not work, because the method will also be called for
> instances of subclasses.
>

Yah, you are right.

> You probably want to define an eql-method on make-instance instead:
>
> (defmethod make-instance
>     ((class (eql (find-class 'forbidden-abstract-class))) &rest initargs)
>   (error "Cannot Instatiate Abstract Class"))

This is better because the error is signalled before much CLOS machinery
gets executed.

Wade