unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: guign@mails.selgrad.org
To: guile-user@gnu.org
Subject: scm_c_make_gsubr parameters
Date: Wed, 30 Dec 2009 23:00:38 +0100	[thread overview]
Message-ID: <20091230220038.GA5642@shoikan> (raw)

Hello all :)

I just found that guile does not like primitive procedures with a lot of
arguments.
	ERROR in scm_c_make_gsubr: too many args (11) func

The (procedure-properties) show correct arities, e.g.
	scm_c_define_gsubr(...,  9, 0, 0, ...)		(arity  9 0 #f)
	scm_c_define_gsubr(..., 10, 0, 0, ...)		(arity 10 0 #f)

For most values I get a meaningful error message:
	scm_c_define_gsubr(..., 11, 0, 0, ...)		too many args (11)
	...
	scm_c_define_gsubr(..., 15, 0, 0, ...)		too many args (15)

Interestingly the following happens at 16 (my actual case):
	scm_c_define_gsubr(..., 16, 0, 0, ...)		(arity 0 1 #f)
	scm_c_define_gsubr(..., 17, 0, 0, ...)		(arity 1 1 #f)

From 18 on everything is back to normal
	scm_c_define_gsubr(..., 18, 0, 0, ...)		too many args (18)
	...

I think the case with 16 is clear, but I neither found the limit of 10,
nor the special case of 16 documented in the guile 1.8.5 manual (the
version I'm using). So this might be something to help confused people
around section 5.8.2 "Primitive Procedures".  :)

In my case of 16 arguments I got the error "Invalid Number of Arguments"
when calling my procedure. I counted a lot today... ;)

And yes, 16 parameters is really insane, I know. I was just hacking a
little piece of test code and didn't want to look the C list functions
up. If i would have written clean code I might have never stumbled
across it :)

Have a nice time :)
	Kai.





             reply	other threads:[~2009-12-30 22:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 22:00 guign [this message]
2010-01-02 23:38 ` scm_c_make_gsubr parameters Ludovic Courtès
2010-01-03 17:46   ` guign

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=20091230220038.GA5642@shoikan \
    --to=guign@mails.selgrad.org \
    --cc=guile-user@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).