unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* scm_c_make_gsubr parameters
@ 2009-12-30 22:00 guign
  2010-01-02 23:38 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: guign @ 2009-12-30 22:00 UTC (permalink / raw)
  To: guile-user

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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_c_make_gsubr parameters
  2009-12-30 22:00 scm_c_make_gsubr parameters guign
@ 2010-01-02 23:38 ` Ludovic Courtès
  2010-01-03 17:46   ` guign
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2010-01-02 23:38 UTC (permalink / raw)
  To: guile-user

Hi,

guign@mails.selgrad.org writes:

> 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".  :)

10 is the real limit, and I agree it should be documented.  Would you
like to propose a patch?

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_c_make_gsubr parameters
  2010-01-02 23:38 ` Ludovic Courtès
@ 2010-01-03 17:46   ` guign
  0 siblings, 0 replies; 3+ messages in thread
From: guign @ 2010-01-03 17:46 UTC (permalink / raw)
  To: guile-user

On 00:38 Sun 03 Jan     , Ludovic Courtès wrote:
> 10 is the real limit, and I agree it should be documented.  Would you
> like to propose a patch?
Yes, I'll see to it :)




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-03 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 22:00 scm_c_make_gsubr parameters guign
2010-01-02 23:38 ` Ludovic Courtès
2010-01-03 17:46   ` guign

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).