From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: GOOPS bug found? Date: 17 Apr 2002 21:35:00 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <87sn5uce57.fsf@alice.rhinosaur.lan> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1019072173 30663 127.0.0.1 (17 Apr 2002 19:36:13 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 17 Apr 2002 19:36:13 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16xvDw-0007yS-00 for ; Wed, 17 Apr 2002 21:36:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16xvDq-0007Ue-00; Wed, 17 Apr 2002 15:36:06 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 16xvCr-0007Kh-00 for ; Wed, 17 Apr 2002 15:35:05 -0400 Original-Received: (qmail 20857 invoked by uid 0); 17 Apr 2002 19:34:59 -0000 Original-Received: from m174p026.adsl.highway.telekom.at (HELO alice.rhinosaur.lan) (62.47.189.186) by mail.gmx.net (mp001-rz3) with SMTP; 17 Apr 2002 19:34:59 -0000 Original-Received: from andy by alice.rhinosaur.lan with local (Exim 3.35 #1 (Debian)) id 16xvCm-0000Vl-00; Wed, 17 Apr 2002 21:35:00 +0200 Original-To: bug-guile@gnu.org, guile-devel@gnu.org Original-Lines: 41 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:401 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:401 --=-=-= Hi! [Note: this bug refers to Guile 1.7.0 from CVS, only some days old] As my C++ <-> Guile bindings (ucxx.sf.net) are approaching completeness, I have run into another strange problem. I have managed to isolate the code that causes it and wrote a self-contained C program that exposes the bug. Here is what I do: 1) I create a new class, containing one slot using scm_basic_create_class(). 2) I then add a method to 'initialize', specialized for the newly created class, that calls a C function. 3) I create a new class, inheriting from the C-created class, and instantiate one object of the new class (using make). 4) I do (define-method (initialize (obj ) initargs) (next-method)). This expression leads to this: ERROR: In procedure struct-ref: ERROR: Wrong type argument in position 1 (expecting STRUCTP): () A backtrace (using my original code) is attached, but you should easily be able to reproduce and investigate this strange behaviour using the attached C program. I hope someone can shed light on this strange thing... Regards, Andy --=-=-= Content-Type: text/x-csrc Content-Disposition: attachment; filename=bug.c #include #include static SCM my_constructor(SCM obj, SCM initargs) { printf("constructor called!\n"); scm_slot_set_x(obj, scm_str2symbol("a-slot"), SCM_BOOL_T); return obj; } static void set_constructor(SCM klass, SCM (*proc)(SCM, SCM)) { SCM initialize = scm_variable_ref( scm_c_module_lookup(scm_module_goops, "initialize")); SCM sym_obj = scm_str2symbol("obj"); SCM sym_args = scm_str2symbol("args"); 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 meth = scm_make(scm_list_5(scm_class_method, scm_c_make_keyword("specializers"), scm_list_2(klass, scm_class_top), scm_c_make_keyword("procedure"), constrm)); scm_add_method(initialize, meth); } static void real_main(void *closure, int argc, char *argv[]) { SCM klass, slots; scm_load_goops(); slots = scm_list_1(scm_list_3(scm_str2symbol("a-slot"), scm_c_make_keyword("init-value"), SCM_BOOL_F)); klass = scm_basic_make_class(scm_class_class, scm_makfrom0str(""), scm_list_1(scm_class_object), slots); set_constructor(klass, my_constructor); scm_c_define("", klass); scm_c_eval_string("(use-modules (oop goops))"); scm_c_eval_string("(define-class ())"); scm_c_eval_string("(make )"); // this produces the error scm_c_eval_string("(define-method (initialize (obj ) initargs)" " (next-method))"); } int main(int argc, char *argv[]) { scm_boot_guile(argc, argv, real_main, NULL); return 0; } --=-=-= -- Andreas Rottmann | Dru@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62 --=-=-=-- _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel