guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scm_c_make_gsubr parameters


From: guign
Subject: scm_c_make_gsubr parameters
Date: Wed, 30 Dec 2009 23:00:38 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]