From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Fox Newsgroups: gmane.lisp.guile.bugs Subject: bug#10163: Incomplete/vague section of Guile Manual Date: Tue, 29 Nov 2011 20:17:18 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00151750da4a3b58e904b2e97f30 X-Trace: dough.gmane.org 1322630853 8134 80.91.229.12 (30 Nov 2011 05:27:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2011 05:27:33 +0000 (UTC) To: 10163@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Nov 30 06:27:29 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RVchZ-00027M-Hx for guile-bugs@m.gmane.org; Wed, 30 Nov 2011 06:27:25 +0100 Original-Received: from localhost ([::1]:47790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVchZ-0007Vf-1e for guile-bugs@m.gmane.org; Wed, 30 Nov 2011 00:27:25 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVZ8Z-0003VB-NR for bug-guile@gnu.org; Tue, 29 Nov 2011 20:39:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVZ8Y-0004Ac-FY for bug-guile@gnu.org; Tue, 29 Nov 2011 20:39:03 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVZ8Y-0004AW-AD for bug-guile@gnu.org; Tue, 29 Nov 2011 20:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RVZ8Y-0007QL-EM for bug-guile@gnu.org; Tue, 29 Nov 2011 20:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ryan Fox Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 30 Nov 2011 01:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10163 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132261709728483 (code B ref -1); Wed, 30 Nov 2011 01:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Nov 2011 01:38:17 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RVZ7n-0007PK-GK for submit@debbugs.gnu.org; Tue, 29 Nov 2011 20:38:16 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RVYnh-0006uO-MS for submit@debbugs.gnu.org; Tue, 29 Nov 2011 20:17:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVYnf-0000VY-Ob for submit@debbugs.gnu.org; Tue, 29 Nov 2011 20:17:28 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:50749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVYnf-0000VU-LJ for submit@debbugs.gnu.org; Tue, 29 Nov 2011 20:17:27 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:50763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVYne-0008H0-4T for bug-guile@gnu.org; Tue, 29 Nov 2011 20:17:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVYnc-0000Uv-Ay for bug-guile@gnu.org; Tue, 29 Nov 2011 20:17:26 -0500 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:48210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVYnc-0000Uf-0n for bug-guile@gnu.org; Tue, 29 Nov 2011 20:17:24 -0500 Original-Received: by bke17 with SMTP id 17so124393bke.0 for ; Tue, 29 Nov 2011 17:17:22 -0800 (PST) Original-Received: by 10.205.122.76 with SMTP id gf12mr1806057bkc.26.1322615842259; Tue, 29 Nov 2011 17:17:22 -0800 (PST) Original-Received: from mail-bw0-f41.google.com (mail-bw0-f41.google.com [209.85.214.41]) by mx.google.com with ESMTPS id h7sm454805bkw.12.2011.11.29.17.17.19 (version=SSLv3 cipher=OTHER); Tue, 29 Nov 2011 17:17:21 -0800 (PST) Original-Received: by bke17 with SMTP id 17so124320bke.0 for ; Tue, 29 Nov 2011 17:17:18 -0800 (PST) Original-Received: by 10.204.13.70 with SMTP id b6mr53764737bka.78.1322615838562; Tue, 29 Nov 2011 17:17:18 -0800 (PST) Original-Received: by 10.204.62.3 with HTTP; Tue, 29 Nov 2011 17:17:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Tue, 29 Nov 2011 20:38:14 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 29 Nov 2011 20:39:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Wed, 30 Nov 2011 00:27:22 -0500 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5953 Archived-At: --00151750da4a3b58e904b2e97f30 Content-Type: text/plain; charset=ISO-8859-1 Hello, In section 5.7.1.4, "Writing Guile Primitives for Dia" at http://www.gnu.org/software/guile/manual/guile.html, the description of the square_p() implementation is incomplete. It uses a macro call to ensure that the SCM value is a shape, but does not explain what that implementation is: /* Check that arg is really a shape SMOB. */ SCM_VALIDATE_SHAPE (SCM_ARG1, shape); The explanation merely states: "SCM_VALIDATE_SHAPE is a macro that you should define as part of your SMOB definition: it checks that the passed parameter is of the expected type." After some searching, I was able to figure out that the function scm_assert_smob_type() is probably the intended behaviour for this. However, there was no indication of this in the description. As a side note: I'm a new Schemer, so perhaps this isn't idiomatic, but would it make more sense to use the SCM_SMOB_PREDICATE macro instead? This way, you can simply return false for any type, even if it isn't a shape. Asking if a number is a shape (for example) doesn't strike me as particularly exceptional or incorrect. Thanks, Ryan Fox --00151750da4a3b58e904b2e97f30 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,
In section=A05.7.1.4, "Writing Guile Primitives for Dia"= ; at=A0http= ://www.gnu.org/software/guile/manual/guile.html, the description of the= square_p() implementation is incomplete. It uses a macro call to ensure th= at the SCM value is a shape, but does not explain what that implementation = is:

/* Check that arg is really a shape SMOB. */
SCM_VALIDATE_SHAPE (SCM= _ARG1, shape);

The explanation merely states:
"SCM_VALIDATE_= SHAPE=A0is a macro that you should define as part of your SMOB definition: = it checks that the passed parameter is of the expected type."

After some searching, I was able to figure out that the function=A0scm_= assert_smob_type() is probably the intended behaviour for this. However, th= ere was no indication of this in the description.

As a side note: I&= #39;m a new Schemer, so perhaps this isn't idiomatic, but would it make= more sense to use the=A0SCM_SMOB_PREDICATE macro instead? This way, you ca= n simply return false for any type, even if it isn't a shape. Asking if= a number is a shape (for example) doesn't strike me as particularly ex= ceptional or incorrect.

Thanks,
Ryan Fox

--00151750da4a3b58e904b2e97f30--