public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: spellcard199 <spellcard199@protonmail.com>
To: "kawa@sourceware.org" <kawa@sourceware.org>
Subject: Question: Declaring type to be a Class defined and included inside the same or child library
Date: Tue, 03 Dec 2019 20:45:00 -0000	[thread overview]
Message-ID: <_ql29gn6UnTFza1odb533JD7UjsgUa2iF5i8Xcgr3gWk-qGxIqMTvV4GpSZAZok7ERyTQIRPU2LHtUQ9fCH521s5Dd3-KLxzb_f9j-HHeXE=@protonmail.com> (raw)

Hello. I'm writing here because I'm not sure if this Kawa behavior is the expected one or it's an issue.

I have 3 files:
- 1 file with the library definition
- 2 files, each containing one class

One of the 2 classes has a field whose type is the class defined in the other file.

Minimal Example (I could make it in a single file, but I'm putting the emphasis on the `include`, since `load` works instead)

Class1.scm

  (define-simple-class Class1 ())

Class2.scm

  (define-simple-class Class2 ()
    (x ::<Class1>)
    ((*init*)
     (set! x (Class1))))

foobar.sld

  (define-library (xxx)
    (import (kawa base))
    (include "Class1.scm")
    (include "Class2.scm"))

When I do... :

  kawa -f foobar.sld

... I get an exception:

  Class2.scm:4:4: caught exception in inliner for #<procedure gnu.kawa.functions.AppendValues> - java.lang.RuntimeException: no such class: Class1

I can avoid the exception:
- removing the type declaration
- using `(load "Class2.scm")` instead of `(include "Class2.scm")` in foobar.sld

At the moment I'm using the second option and it works fine for me.

The thing that made me ask instead of assuming this is the expected behavior is that it's ok to use Class1 as a superclass of Class2, so Class2 does "see" Class1. For example, this does not raise an exception:

  (define-simple-class Class2 (Class1)
    (x)
    ((*init*)
     (set! x (Class1))))

So my question is: am I doing it the wrong way or is it a Kawa issue? Should I open an issue in the Kawa repo?

                 reply	other threads:[~2019-12-03 20:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='_ql29gn6UnTFza1odb533JD7UjsgUa2iF5i8Xcgr3gWk-qGxIqMTvV4GpSZAZok7ERyTQIRPU2LHtUQ9fCH521s5Dd3-KLxzb_f9j-HHeXE=@protonmail.com' \
    --to=spellcard199@protonmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).