From: Javier
Subject: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <0d1b712e-fa59-4647-928f-7e5237fa895a@c58g2000hsc.googlegroups.com>
I try to compile a program under SBCL, and get the following warning:

STYLE-WARNING:
   Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
as a
   specializer.
STYLE-WARNING:
   Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
and
   #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO> as specializers.

Next, I try to generate an instance:

> (make-instance 'objeto)

And get this error:

FINALIZE-INHERITANCE was called on a forward referenced class:
  #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>

I don't understand what the compiler means with FORWARD-REFERENCED-
CLASS.
What's this?

I use asdf, if this means something.

I've tested the same program under ECL, and it does work.

From: Tim Bradshaw
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <dac6792d-04b3-4a64-b964-efc67dacba4c@m44g2000hsc.googlegroups.com>
On Jun 29, 2:04 pm, Javier <·······@gmail.com> wrote:

> FINALIZE-INHERITANCE was called on a forward referenced class:
>   #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
>
> I don't understand what the compiler means with FORWARD-REFERENCED-
> CLASS.
> What's this?

It's a class for which the definition has not yet been seen.  For
instance if you define a class before the definition of its
superclass(es) is known, they'll be forward referenced classes.  There
are some things you can't do (such as compute the inheritance, as
above) until all the forward references have been resolved.
From: Kenny
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <4867dcf6$0$7339$607ed4bc@cv.net>
Javier wrote:
> I try to compile a program under SBCL, and get the following warning:
> 
> STYLE-WARNING:
>    Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> as a
>    specializer.
> STYLE-WARNING:
>    Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> and
>    #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO> as specializers.
> 
> Next, I try to generate an instance:
> 
>> (make-instance 'objeto)
> 
> And get this error:
> 
> FINALIZE-INHERITANCE was called on a forward referenced class:
>   #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> 
> I don't understand what the compiler means with FORWARD-REFERENCED-
> CLASS.

That is optimisticspeak for "undefined". The weird forward thing is 
actually about a feature: one could define class Two in heriting from 
class One before defining class One. Lisp would note that a forward (in 
the code) referenced class was being used and cut you a break if you 
defined it (later in the code) before doing anything interesting with 
class Two. It seems defining a method is interesting.

hth, kt
From: Javier
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <d7845fa9-3ab3-4488-a053-d0ff828cd509@m73g2000hsh.googlegroups.com>
On 29 jun, 21:04, Kenny <·········@gmail.com> wrote:

> > I don't understand what the compiler means with FORWARD-REFERENCED-
> > CLASS.
>
> That is optimisticspeak for "undefined". The weird forward thing is
> actually about a feature: one could define class Two in heriting from
> class One before defining class One. Lisp would note that a forward (in
> the code) referenced class was being used and cut you a break if you
> defined it (later in the code) before doing anything interesting with
> class Two. It seems defining a method is interesting.

This confirms to me that it is an ASDF issue:

(defsystem mysystem
  :name "Mysystem"
  :version "0.1"
  :components ((:file "defpackage")
	       (:file "core" :depends-on ("defpackage"))
	       (:file "other" :depends-on ("core"))
	       (:file "other2" :depends-on ("core" "other"))
	       )

  :depends-on ())

If I define a class on "core.lisp", and a child of it in "other.lisp",
and a child of this in "other2.lisp", it seems that I get this error.
But it happens randomly.
For example, if I compile the system entirely, the error   FORWARD-
REFERENCED-CLASS  appears. If I remove the dependencies, it does not
happen, but then ramdomly (depending on which files are loaded and
compiled each time) I get an even worse error: package Mysystem not
found, and some unbound variables, too.
Yes, this is weird... Any suggestion?

I've also noted that using that defsystem, I get many "redefining"
warnings.

I don't understand why ECL is able to manage this correctly, and not
SBCL.
From: Kenny
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <48681af6$0$7361$607ed4bc@cv.net>
Javier wrote:
> On 29 jun, 21:04, Kenny <·········@gmail.com> wrote:
> 
>>> I don't understand what the compiler means with FORWARD-REFERENCED-
>>> CLASS.
>> That is optimisticspeak for "undefined". The weird forward thing is
>> actually about a feature: one could define class Two in heriting from
>> class One before defining class One. Lisp would note that a forward (in
>> the code) referenced class was being used and cut you a break if you
>> defined it (later in the code) before doing anything interesting with
>> class Two. It seems defining a method is interesting.
> 
> This confirms to me that it is an ASDF issue:
> 
> (defsystem mysystem
>   :name "Mysystem"
>   :version "0.1"
>   :components ((:file "defpackage")
> 	       (:file "core" :depends-on ("defpackage"))
> 	       (:file "other" :depends-on ("core"))
> 	       (:file "other2" :depends-on ("core" "other"))
> 	       )
> 
>   :depends-on ())
> 
> If I define a class on "core.lisp", and a child of it in "other.lisp",
> and a child of this in "other2.lisp", it seems that I get this error.
> But it happens randomly.
> For example, if I compile the system entirely, the error   FORWARD-
> REFERENCED-CLASS  appears.

That is surprising, unless you just have the code in the wrong order. 
What do you mean "entirely"? :force t?


> If I remove the dependencies, it does not
> happen, but then ramdomly (depending on which files are loaded and
> compiled each time) I get an even worse error: package Mysystem not
> found, and some unbound variables, too.
> Yes, this is weird... Any suggestion?

I think you are just completely messed up. ASDF will not find the file 
one time and not another. Possibly you are bouncing your Lisp and 
failing to initialize *central-registry*, and confusing that with the 
other errors you are experiencing when they are wholly unrelated. This 
is normal when fighting it out with a new environment.

You need to take a nap, start from scratch, fix the first error.

kt
From: Javier
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <fa7219bd-d99c-4278-9fd8-4842b9d6ee38@e39g2000hsf.googlegroups.com>
On 30 jun, 01:29, Kenny <·········@gmail.com> wrote:
> Javier wrote:
> > On 29 jun, 21:04, Kenny <·········@gmail.com> wrote:
>
> >>> I don't understand what the compiler means with FORWARD-REFERENCED-
> >>> CLASS.
> >> That is optimisticspeak for "undefined". The weird forward thing is
> >> actually about a feature: one could define class Two in heriting from
> >> class One before defining class One. Lisp would note that a forward (in
> >> the code) referenced class was being used and cut you a break if you
> >> defined it (later in the code) before doing anything interesting with
> >> class Two. It seems defining a method is interesting.
>
> > This confirms to me that it is an ASDF issue:
>
> > (defsystem mysystem
> >   :name "Mysystem"
> >   :version "0.1"
> >   :components ((:file "defpackage")
> >           (:file "core" :depends-on ("defpackage"))
> >           (:file "other" :depends-on ("core"))
> >           (:file "other2" :depends-on ("core" "other"))
> >           )
>
> >   :depends-on ())
>
> > If I define a class on "core.lisp", and a child of it in "other.lisp",
> > and a child of this in "other2.lisp", it seems that I get this error.
> > But it happens randomly.
> > For example, if I compile the system entirely, the error   FORWARD-
> > REFERENCED-CLASS  appears.
>
> That is surprising, unless you just have the code in the wrong order.
> What do you mean "entirely"? :force t?
>
> > If I remove the dependencies, it does not
> > happen, but then ramdomly (depending on which files are loaded and
> > compiled each time) I get an even worse error: package Mysystem not
> > found, and some unbound variables, too.
> > Yes, this is weird... Any suggestion?
>
> I think you are just completely messed up. ASDF will not find the file
> one time and not another. Possibly you are bouncing your Lisp and
> failing to initialize *central-registry*, and confusing that with the
> other errors you are experiencing when they are wholly unrelated. This
> is normal when fighting it out with a new environment.
>
> You need to take a nap, start from scratch, fix the first error.
>
> kt

Yes, you are right. I had the following problems:
- I compiled the files in the wrong order.
- I corrected the order.
- Still having the same error.
- After a while, I removed the ".fasl" files.
- Compiled again the system, and everything went all right.

But if there is something to learn about this... take care about ASDF,
and, second, SBCL is very sensitive about compilations levels. This is
not the first time that I have a similar problem. When using functions
inside macros in the same file, it produces "undefined function"
errors, while in both CLISP and ECL it just works.
From: Stephen Compall
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <m2d4lzpwhc.fsf@member.fsf.org>
Javier <·······@gmail.com> writes:
> For example, if I compile the system entirely, the error   FORWARD-
> REFERENCED-CLASS  appears.

Do you mean here that you delete all the fasls, then load-op the system
in an image where it hasn't been loaded?

-- 
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
From: Javier
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <17bf615a-3ff3-4487-aa00-7b0e9dc6517a@j22g2000hsf.googlegroups.com>
On 30 jun, 03:01, Stephen Compall <····@member.fsf.org> wrote:
> Javier <·······@gmail.com> writes:
> > For example, if I compile the system entirely, the error   FORWARD-
> > REFERENCED-CLASS  appears.
>
> Do you mean here that you delete all the fasls, then load-op the system
> in an image where it hasn't been loaded?
>
> --
> But you know how reluctant paranormal phenomena are to reveal
> themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003

Yes, that's right. Now it does work. Thanks.
From: Pascal Costanza
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <6cptj8F3hb6rtU1@mid.individual.net>
Javier wrote:
> I try to compile a program under SBCL, and get the following warning:
> 
> STYLE-WARNING:
>    Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> as a
>    specializer.
> STYLE-WARNING:
>    Defining a method using #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> and
>    #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO> as specializers.
> 
> Next, I try to generate an instance:
> 
>> (make-instance 'objeto)
> 
> And get this error:
> 
> FINALIZE-INHERITANCE was called on a forward referenced class:
>   #<SB-MOP:FORWARD-REFERENCED-CLASS OBJETO>
> 
> I don't understand what the compiler means with FORWARD-REFERENCED-
> CLASS.
> What's this?
> 
> I use asdf, if this means something.
> 
> I've tested the same program under ECL, and it does work.

That's weird. Can you show us the code?


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Javier
Subject: Re: FORWARD-REFERENCED-CLASS
Date: 
Message-ID: <6155c392-de69-44c5-a5a9-8c1b61be3595@x35g2000hsb.googlegroups.com>
On 29 jun, 19:03, Pascal Costanza <····@p-cos.net> wrote:

> > I've tested the same program under ECL, and it does work.
>
> That's weird. Can you show us the code?

Too large to show it here. But I put a larger response to the Kenny
post.