[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH][5] Change procedure argument type relation
From: |
megane |
Subject: |
Re: [Chicken-hackers] [PATCH][5] Change procedure argument type relation to contravariant |
Date: |
Sat, 21 Apr 2018 10:22:34 +0300 |
User-agent: |
mu4e 0.9.18; emacs 25.1.1 |
Hi Evan,
I don't think you can apply this patch as is, there will be just too
many warning messages by the scrutinizer.
Declaring a function like this:
(: foo ((* -> *) -> *))
doesn't say foo doesn't care what the passed function takes as argument.
It says that function must take _everything_ thrown at it.
If you don't care about what the argument is you should quantify it:
(: foo (forall (a) ((a -> *) -> *)))
One reason for warnings is this line in call-result:
(xptype `(procedure ,(make-list nargs '*) *))
I think this is just used to check that the argument count of the call
is compatible with the function's signature. Changing the '* to
'noreturn works here, but is a bit of a hack. You could also use forall
and generate new variables.
Another reason for warnings is the types.db. For example:
(chicken.sort#sorted? (#(procedure #:enforce) chicken.sort#sorted? ((or
list vector) (procedure (* *) *)) boolean))
It's not enough LESS? works for elements in the sequence, it must also
work for everything else.
A more lightweight forall syntax could help. Maybe ML style would work
(: foo (('a 'b -> *) -> *))
This would be translated into:
(: foo (forall (a b) ((a b -> *) -> *)))
Even if you use forall there's a risk the type will go through resolve,
which will resolve all non-unified type variables into '*.
Evan Hanson <address@hidden> writes:
> Hi megane,
>
> I just wanted to let you know this hasn't fallen off the map -- I'm
> hoping to look into this next week.
>
> Thanks for your patience,
>
> Evan