* bug#10163: Incomplete/vague section of Guile Manual
@ 2011-11-30 1:17 Ryan Fox
2011-12-22 14:34 ` Andy Wingo
0 siblings, 1 reply; 2+ messages in thread
From: Ryan Fox @ 2011-11-30 1:17 UTC (permalink / raw)
To: 10163
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1288 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#10163: Incomplete/vague section of Guile Manual
2011-11-30 1:17 bug#10163: Incomplete/vague section of Guile Manual Ryan Fox
@ 2011-12-22 14:34 ` Andy Wingo
0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-12-22 14:34 UTC (permalink / raw)
To: Ryan Fox; +Cc: 10163-done
Hi Ryan,
Thanks for the report.
On Tue 29 Nov 2011 20:17, Ryan Fox <ryan@rcfox.ca> writes:
> /* Check that arg is really a shape SMOB. */
> SCM_VALIDATE_SHAPE (SCM_ARG1, shape);
>
> 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.
I changed the example and the text to use scm_assert_smob_type. This
entire section could use some modernization and less hand-waving, but
that is a larger project.
Happy hacking,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-22 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30 1:17 bug#10163: Incomplete/vague section of Guile Manual Ryan Fox
2011-12-22 14:34 ` Andy Wingo
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).