This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> It occured to me that since the scheme execution process checks the > number of arguments as it does the bindings of procedure arguments, > it could (in theory) also check their types and thus allow type-based > procedure call signatures like you get with java. Would this be at all > useful? Would it make compilation of scheme code impossible? I guess > it would be a pretty major extension to R4RS too. > > Well, just an idea... I think Chez Scheme has an extension called case-lambda (or something like that) where you can do pattern-matching on the number and structure of the arguments: (case-lambda ((a) ... code to run when called with one argument ...) ((a b) ... code to run when called with two arguments ...) ...) I don't see any reason this couldn't be extended to: (case-lambda ((a) ... blah ...) ((a b) ... blah ...) ((a (b c ...)) ... second argument must be a list of at least one element, c is bound to its tail) (((number? a) b c) ... three arguments, the first of which must be a number ...)) Or something like that. Don't shoot me over the syntax.