GNU bug report logs - #31154
predicate function for foreign-object not obvious

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Matt Wette <matt.wette@HIDDEN>; dated Sat, 14 Apr 2018 18:35:01 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 31154 <at> debbugs.gnu.org:


Received: (at 31154) by debbugs.gnu.org; 14 Apr 2018 19:25:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 14 15:25:44 2018
Received: from localhost ([127.0.0.1]:52685 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f7Qnw-0004MS-DY
	for submit <at> debbugs.gnu.org; Sat, 14 Apr 2018 15:25:44 -0400
Received: from mail-pf0-f174.google.com ([209.85.192.174]:46619)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt.wette@HIDDEN>) id 1f7Qnu-0004MG-JU
 for 31154 <at> debbugs.gnu.org; Sat, 14 Apr 2018 15:25:42 -0400
Received: by mail-pf0-f174.google.com with SMTP id h69so8618325pfe.13
 for <31154 <at> debbugs.gnu.org>; Sat, 14 Apr 2018 12:25:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding:content-language;
 bh=VgnV1fZsWy/izTxtg+xJeccc18aNkbGH58JRe5Mzje0=;
 b=YywhPB+axKH5DLKmhwHqxyTMlf46pcyQlNq9K2dCJz4KV1PgltjVT10m8azGUzL+Hc
 BY/cTkmB9oQvu5MAyP34gsu8sllxTtHXMOUiHLOtUcgokjCjowCk6d4dC/HW7GNuaosX
 tfWQT/k2TQJzoWdlCB4Ui43L5Iv9TVcR+rzH9dcKlO8QdN/Y6YaqsDHAUscFkwuUCDdf
 AvvBv3Q73Ac6u9gKjSQ11gr6fYjPibyOX+l51CAFLRvxtYTp5bjw8DKDVYc3+LOMSY4p
 x2QQLkqWlRf6Ij+IK1/aiAsRf01yjp7aj6fS934P5JtkR+nhOoyvIGR75lRpnwxsLhuv
 s+UA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=VgnV1fZsWy/izTxtg+xJeccc18aNkbGH58JRe5Mzje0=;
 b=HjlXOgAMIOXOT2hXSurbK81ziQWSLNzimHCJgyOKmSsOJEFPebjGAekqtPZ/DNzRE5
 YkSq34G8WIXvhmr4Byo0C6Jskg2pzZi6+j5+pWa6GASh0VwsN3LO6pHKL38g1wMW8rhO
 /C1vfcoy8Oo2e6Ww4/wfSLG7Jha7dXovxNpWpDgFec9OM3Pk5m1YvfpoLBApN5COcLmT
 Svh31kEnE5RP+o0q5ymycmNlbfSFRzBWi6U6vcWyQmy6y/fe+9FO+a5PErPbjNHJzsrC
 5++quWQ/B/iR2dUBKJA7/eK3Zade0/d3A6AkePj2/MEL4fTCc1/omjJBKvNQP7GPRhi7
 g2CQ==
X-Gm-Message-State: ALQs6tBxbZc85jqOjQV/hk7+6Ltx/yuzs4VD5xWL/MJr6Cva+ULLe6v6
 oI3lXx2LySslz5qflgd15EdVvEaT
X-Google-Smtp-Source: AIpwx48NFIDYRyByYw1ODgRDTX0S0ERz54xaEcaHMx3Qou66H7nNY30ny7sPbfrKbgP5rdZ9I8MK3Q==
X-Received: by 10.167.133.198 with SMTP id z6mr7781063pfn.38.1523733936185;
 Sat, 14 Apr 2018 12:25:36 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
 [216.165.229.229])
 by smtp.gmail.com with ESMTPSA id 76sm13796289pge.5.2018.04.14.12.25.35
 for <31154 <at> debbugs.gnu.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 14 Apr 2018 12:25:35 -0700 (PDT)
Subject: Re: bug#31154: Acknowledgement (predicate function for foreign-object
 not obvious)
To: 31154 <at> debbugs.gnu.org
References: <689d625b-94f7-919b-c017-fa921d54c744@HIDDEN>
 <handler.31154.B.152373085729032.ack <at> debbugs.gnu.org>
From: Matt Wette <matt.wette@HIDDEN>
Message-ID: <664618b2-ad6b-5b29-c181-b3157e953209@HIDDEN>
Date: Sat, 14 Apr 2018 12:25:34 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <handler.31154.B.152373085729032.ack <at> debbugs.gnu.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 31154
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Perhaps it belongs with the demo in Section 5.5 Defining New Foreign Object Types,
with the image demo.





Information forwarded to bug-guile@HIDDEN:
bug#31154; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Apr 2018 18:34:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 14 14:34:16 2018
Received: from localhost ([127.0.0.1]:52603 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f7Q08-0007YC-IK
	for submit <at> debbugs.gnu.org; Sat, 14 Apr 2018 14:34:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50400)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt.wette@HIDDEN>) id 1f7Q05-0007Xv-9U
 for submit <at> debbugs.gnu.org; Sat, 14 Apr 2018 14:34:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <matt.wette@HIDDEN>) id 1f7Pzz-0003VE-CR
 for submit <at> debbugs.gnu.org; Sat, 14 Apr 2018 14:34:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44102)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <matt.wette@HIDDEN>)
 id 1f7Pzz-0003V1-9W
 for submit <at> debbugs.gnu.org; Sat, 14 Apr 2018 14:34:07 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41322)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <matt.wette@HIDDEN>) id 1f7Pzx-0006sV-V1
 for bug-guile@HIDDEN; Sat, 14 Apr 2018 14:34:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <matt.wette@HIDDEN>) id 1f7Pzu-0003SK-O2
 for bug-guile@HIDDEN; Sat, 14 Apr 2018 14:34:05 -0400
Received: from mail-pl0-x22e.google.com ([2607:f8b0:400e:c01::22e]:41665)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <matt.wette@HIDDEN>)
 id 1f7Pzu-0003Ru-IE
 for bug-guile@HIDDEN; Sat, 14 Apr 2018 14:34:02 -0400
Received: by mail-pl0-x22e.google.com with SMTP id bj1-v6so7809104plb.8
 for <bug-guile@HIDDEN>; Sat, 14 Apr 2018 11:34:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:from:subject:message-id:date:user-agent:mime-version
 :content-transfer-encoding:content-language;
 bh=b5IT9L9VbsdYl2taZhBE2IhsE9gsWC3fZChv+MHUPjU=;
 b=StwXBwNjcfqovfVJoWhRRZ2ulAhUY/Dzy7QBN2Mk2HVyewEtAMYi3d2Wd8qT13nmL2
 kOvIJilzzEZ43tYHugqLmRsum1b3kaQT1RuOb0l1ihwTsJIXFPgkMcdQg5SDwPlqv35U
 RZGzHrHaWe9Q1mID1x8pAY+C+0aHob6VAqCg/HRCd7HZDZNgWM9ok/4Yn61dZjr++Hzh
 CmCcDRiJyWpkvnlNjphO9wUlQQyvXDZvzFu2AIY0bXdSRgUnrbzYzhhW6oh148e6jZta
 NCafZ4f2ts17VUz3ox9voVN3SPBw+/FseCJ1+s3gXQ7ZgbhijtYhiQXEzxq7Cqt9fHsX
 CXVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:from:subject:message-id:date:user-agent
 :mime-version:content-transfer-encoding:content-language;
 bh=b5IT9L9VbsdYl2taZhBE2IhsE9gsWC3fZChv+MHUPjU=;
 b=WTEEDOynWukbwoqUdnqZyuWdt384mBCl98jL1q0QiqkoLbor114B3abJ2MF4n2djo4
 +dPoFXAh0BDJoOAej9LU+R8+aGAVuy/sUQj0wRlas18cr4aRp7ExijMOX9DobefMYfsh
 pX5QgtOV7u9Y/DFelz6CBwCP0/lMmvMDHl9jxO7/ZSR61xLlsMAXEa9xbvLJxZMjxese
 gzKcJgJC89SnhS8BXfzzn/BPD9hqhmsRgoIhk3U/mjJu8dDwFLnDnLBdhBsDNCm0PqF+
 0JKR4J2uRvUpNNrurOjOaeDC437zM10TdR4BVEe+lPkFncrwQE3SRGI8DZVXbrrr9u3p
 QvRg==
X-Gm-Message-State: ALQs6tB4hD+LWZhx0qr3lc/i5TFGTcZ6mzDthgRWLiNHrLIAHj+/PM+i
 W53ywmiVUdrApca2y4lkq+KPev8/
X-Google-Smtp-Source: AIpwx4/yr1eeKiSi0f5aUG/pw4YAtqvdes4CGUVdhSy7SpRVviboMSBwniecD2DpdS3M8FlAWt5A1Q==
X-Received: by 2002:a17:902:7405:: with SMTP id
 g5-v6mr9631350pll.4.1523730841308; 
 Sat, 14 Apr 2018 11:34:01 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
 [216.165.229.229])
 by smtp.gmail.com with ESMTPSA id a12sm19838981pfe.78.2018.04.14.11.34.00
 for <bug-guile@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 14 Apr 2018 11:34:00 -0700 (PDT)
To: bug-guile@HIDDEN
From: Matt Wette <matt.wette@HIDDEN>
Subject: predicate function for foreign-object not obvious
Message-ID: <689d625b-94f7-919b-c017-fa921d54c744@HIDDEN>
Date: Sat, 14 Apr 2018 11:33:59 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

The reference manual (guile-2.2.3) does not provide instruction on how to generate
a predicate for a foreign object, and it is not obvious.  Maybe it doesn't need to
be in the manual but should then be in an example somewhere, IMO.

The following patch to the reference manual is one option:


--- doc/ref/api-foreign-objects.texi-orig	2018-04-14 11:26:35.779502997 -0700
+++ doc/ref/api-foreign-objects.texi	2018-04-14 11:28:42.823072217 -0700
@@ -96,6 +96,33 @@
  needed.
  @end deftypefn
  
+To generate a predicate for a foreign object use the @code{SCM_IS_A_P}
+macro as follows.
+
+@example
+static SCM foo_type;
+
+static SCM
+scm_foo_p(SCM obj) {
+  return SCM_IS_A_P(obj, foo_type)? SCM_BOOL_T: SCM_BOOL_F;
+}
+
+void
+init_foo()
+{
+  SCM name, slots;
+
+  name = scm_from_utf8_symbol("foo");
+  slots = scm_list_2 (scm_from_utf8_symbol ("data"),
+		      scm_from_utf8_symbol ("deps"));
+  finalizer = NULL;
+  foo_type = scm_make_foreign_object_type(name, slots, finalizer);
+
+  scm_c_define_gsubr("foo?", 1, 0, 0, scm_foo_p);
+  ...
+}
+@end example
+
  One can also access foreign objects from Scheme.  @xref{Foreign Objects
  and Scheme}, for some examples.
  





Acknowledgement sent to Matt Wette <matt.wette@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#31154; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.