[plt-scheme] Higher-order contracts for variable-arity functions
At Thu, 25 May 2006 15:47:03 -0400, "Carl Eastlund" wrote:
> On 5/25/06, Robby Findler <robby at cs.uchicago.edu> wrote:
> > > > My point is that I don't care about the list. I care about the
> > > > function arguments. I want to apply a function contract to each
> > > > argument to my function. If they get taken out of the list, or
> > > > other
> > > > values get put into the list, I don't care, because the list itself
> > > > was only a convenient delivery mechanism for my many arguments.
> >
> > It is unsound in general to do that and in this specific case, the
> > contract system can't tell that the list won't be mutated (if you
> > follow the N negatives there) and so is being conservative.
>
> I am not trying to apply a contract to a list. I do not want to use
> listof - my point is not to change listof, but to write an alternative
> so that I may avoid using listof.
You need an alternate lambda too; hence my suggestion to petition the
R6RS authors.
> In my interpretation, the fact that
> the arguments are delivered in a list is a byproduct. Only the list's
> elements are actually arguments to the function, so I want to apply a
> contract to the arguments that are passed in. Conceptually, I want to
> consider the contract as coming before the "list" is built around the
> rest arguments. Pragmatically, this may mean the contract system has
> to destructure the list, apply contracts to each element, and rebuild
> the list. This should be safe, though - the list is fresh anyway,
> replacing it with a different one shouldn't change anything.
The contract system can't tell that the list won't be mutated/
Robby