chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] Ports checking


From: Felix
Subject: Re: [Chicken-hackers] Ports checking
Date: Mon, 26 Sep 2011 12:37:03 +0200 (CEST)

>  I've noticed that at least in extras.scm almost none of the procedures
>  check whether they get the *right* port, i.e. whether read routines
>  get input-port and write procedures get output-ports.

True. These ought to get extended. There are also more things that
should be done: ##sys#check-port-mode could implicitly check for the
argument being a port. ##sys#check-port* doesn't pass the location to
##sys#check-port. And ##sys#check-port + ##sys#check-port* should be
rewritten to cheaper forms to avoid a CPS call ... Phew. So much to
do.

>
>  The obvious thing would be to add type checks to each but maybe
>  that could also be done by the scrutinizer? Is it (by design)
>  possible to extend it that way to add some tags to a port identifier?

For library code it might be better to add those checks manually.
Joerg already suggested type-check generation, but I haven't had the
time to investigate this. So much to do.

>
>  At the moment there is no extra type tag for ports is there?

"port" is the type-specifier for ports.

>
>  The more I think about it the more I like the idea to let this work
>  be done by the scrutinizer.
>
>  If the check fails most of the procedures will fail with a 
>  'Error: call of non-procedure: #f' as they do now.

Yes, that sucks.


cheers,
felix



reply via email to

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