unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-devel@gnu.org
Subject: Re: Fixing goops-1
Date: 03 Oct 2002 22:33:26 +0100	[thread overview]
Message-ID: <m3wuozfbrt.fsf@laruns.ossau.uklinux.net> (raw)
In-Reply-To: <87u1k6qalv.fsf@alice.rotty.yi.org>

>>>>> "Andreas" == Andreas Rottmann <a.rottmann@gmx.at> writes:

    Andreas> Hi!  Remember the goops-1 bug? I'd really like this one
    Andreas> fixed, since it is stopping me to test Guile as an
    Andreas> extension language for my C++ programs - I'd be stick
    Andreas> with Python ;-)). However, I don't have the necessary
    Andreas> insight into the GOOPS internals. If someone of GOOPS
    Andreas> authorship or deeper GOOPS knowledge could guide me, I
    Andreas> would like help, though.

Hi Andy,

I don't fully understand this stuff, but through a kind of
investigation and experimentation, I have a solution.  If you change
the second arg of scm_closure from SCM_EOL to scm_top_level_env
(SCM_TOP_LEVEL_LOOKUP_CLOSURE), the define-method call works.

Full patch (to your source) is below.  I played around with this by
inserting scm_shell, so that I could use the debugger interactively to
look at frames, which in turn needed SCM_RECORD_POSITIONS_P = 1 and
the commenting out of the `:no-backtrace' option in the GOOPS .scm
files.  I tested the commented out define-method call by typing it
into the Guile shell.

I'm guessing that you took your model from scm_add_slot, which also
passes SCM_EOL to scm_closure.  However, note that nothing in Guile
actually uses scm_add_slot ... :-)

Hope this helps,
        Neil

cd ~/Guile/miscellany/goops-1/
diff -Naur /home/neil/Guile/miscellany/goops-1/bug.c\~ /home/neil/Guile/miscellany/goops-1/bug.c
--- /home/neil/Guile/miscellany/goops-1/bug.c~	Wed Oct  2 22:13:07 2002
+++ /home/neil/Guile/miscellany/goops-1/bug.c	Wed Oct  2 23:53:32 2002
@@ -19,7 +19,7 @@
   SCM constr = scm_c_make_gsubr("constructor", 1, 0, 1, proc);
   SCM constrm = scm_closure(scm_list_2(scm_list_2(sym_obj, sym_args),
                                        scm_list_3(constr, sym_obj, sym_args)),
-                            SCM_EOL);
+                            scm_top_level_env (SCM_TOP_LEVEL_LOOKUP_CLOSURE));
   SCM meth = scm_make(scm_list_5(scm_class_method,
                                 scm_c_make_keyword("specializers"),
                                 scm_list_2(klass, scm_class_top),
@@ -32,7 +32,7 @@
 static void real_main(void *closure, int argc, char *argv[])
 {
   SCM klass, slots;
-
+  SCM_RECORD_POSITIONS_P = 1;
   scm_load_goops();
   
   slots = scm_list_1(scm_list_3(scm_str2symbol("a-slot"),
@@ -48,10 +48,11 @@
   scm_c_eval_string("(use-modules (oop goops))");
   scm_c_eval_string("(define-class <new-object> (<my-object>))");
   scm_c_eval_string("(make <new-object>)");
+  scm_shell (argc, argv);
 
   // this produces the error
-  scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)"
-                    "  (next-method))");
+/*    scm_c_eval_string("(define-method (initialize (obj <new-object>) initargs)" */
+/*                      "  (next-method))"); */
 }
 
 int main(int argc, char *argv[])

Diff finished at Wed Oct  2 23:59:15



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


      parent reply	other threads:[~2002-10-03 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-01 18:26 Fixing goops-1 Andreas Rottmann
2002-10-02 23:15 ` Neil Jerram
2002-10-03 20:45   ` Andreas Rottmann
2002-10-04 18:45     ` Neil Jerram
2002-10-03 21:33 ` Neil Jerram [this message]

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=m3wuozfbrt.fsf@laruns.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.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).