Evan Hanson <ev...@foldling.org> writes:

> Hi megane, happy holidays!

Happy holidays, Evan and everyone!

>
> A quick question about this -- ought the scrutinizer try to improve the
> specificity of the ##core#the annotation, rather than having
> annotate-foreign-procedure skip emitting it entirely?

It would be ideal if we could add some bits of type information and let
the scrutinizer infer the rest. I think that would need some thought,
and/or experimentation.

In these patches I dropped the annotations that added no information the
scrutinizer couldn't infer. For example in (* * -> *) the only
information is the arity of the function, which the scrutinizer can
infer. There's only 1 return value from foreign functions, too (right?).

>
> ISTR it doesn't even look at the types in ##core#the nodes, but maybe it
> should? I'd guess that would simplify this code, and might also give
> benefits in other places, but maybe there's a reason it doesn't...

Scrutinizer does walk ##core#the nodes. There's the error message
r-type-mismatch-in-the for the situation where the annotation is
incompatible with the inferred type.

---

More on the ideal behaviour:

There should a way for the user to override (if compatible) the type for
definitions. If the user specifies (: foo (-> *)) the return type of foo
should be * even if the scrutinizer could infer the actual return type
to be, say a fixnum. That gives more freedom for a library writer from
an API design perspective.

>
> Evan

Reply via email to