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

Re: function signature type checking



"Scott McKay" <swm@mediaone.net> writes:
> "Ray Blaak" <blaak@telus.net> wrote in message
> > This is the kind of thing I would like to be able to do:
> >
> >   define signature <accumulator> (sum :: <number>; n :: <number>)
> >     => result :: <number>;
> 
> You don't need anything magic here.  This signature is "just"
> 
>   limited(<function>,
>              required-parameters: #[<number>, <number>],
>              result-type: #[<number>])
> 
> Unfortunately, what I just wrote is not enough to do the job, because
> there are a bunch of other things to worry about.

What I was explicitly trying to do was to split the notion of a
callable function from a signature specification into separate types.

My instinct is that this would allow easier resolution of the "bunch of other
things to worry about". I could very well be wrong, of course. Could you give
me a sense of what some of those other issues are?

My reason for thinking about this approach is because that is how some other
languages have dealt with the issue: Ada's and Pascal's function pointers,
Java's interfaces, etc. In these cases there is a notion of a "specification"
type (i.e. signature) that is a separate beast from actual functions, but the
compiler and runtime can check that they conform.

Caveat: I am new to Dylan and my expectations from other languages could very
well be misleading me.

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@telus.net                                The Rhythm has my soul.



Follow-Ups: References: