[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] scrutinizer warning in dotted argument notation when
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] scrutinizer warning in dotted argument notation when using units |
Date: |
Sun, 4 Aug 2013 19:08:37 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Aug 04, 2013 at 01:50:06PM -0300, Hugo Arregui wrote:
> Hi!
Hi!
> I noticed this warning using the latest version from master:
>
> ;test.scm
> (use data-structures)
> (flatten '(1 2 3) '(4 5 6) '(7))
>
> address@hidden test]$ csc test.scm
>
> Warning: at toplevel:
> (test.scm:3) in procedure call to `flatten', expected 1 argument,
> but was given 3 arguments
>
> Is also easily reproducible with any file included as unit, declaring
> a procedure using dotted argument notation. This is not happening if
> the procedure is defined in the same file. I'm not sure why.
I don't understand what you mean by the above. Can you produce a simple
test situation?
> I take a look at scrutinizer.scm just to learn how it works, and I'm
> sending a patch, but I'm not sure if its correct.
I'm not 100% sure but it looks like your patch causes it to simply stop
processing argument type declarations altogether as soon as it encounters
a pair.
For example, if you have a procedure of (boolean fixnum pair flonum vector),
it would see it as if it were declared as (boolean fixnum).
> (Also, if someone is in teaching mood:
> 1) debugging the scrutinizer I found sometimes procedures or vars are
> replaced with '*, what does it means?
* is the "any" or "unknown" type. Anything will match it. It's basically
used when you don't know the type of a value.
> 2) if someone figures out.. why is this not happening on procedures in
> the same file? )
A test would be useful.
I've just pushed the attached patch to master: the problem was actually
simply in the type definition for flatten; it accepts any number of
arguments which may be of any type, but it was declared as accepting only
one argument, which had to be a pair.
Cheers,
Peter
--
http://www.more-magic.net
0001-Adds-letrec-and-minimal-tests.-letrec-ist-not-used-e.patch
Description: Text document