Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!accuvax.nwu.edu!krulwich From: krulwich@ils.nwu.edu (Bruce Krulwich) Newsgroups: comp.lang.scheme Subject: RETURN-ARITY of a function (was Re: Request for Comments: ...) Message-ID: <1671@accuvax.nwu.edu> Date: 28 Nov 89 18:09:30 GMT References: <891127-144857-1155@Xerox> <8911272329.AA07264@garlic.Stanford.EDU> Sender: news@accuvax.nwu.edu Reply-To: krulwich@ils.nwu.edu (Bruce Krulwich) Organization: Institute for the Learning Sciences, Northwestern University, Evanston, IL 60201 Lines: 32 In-reply-to: mkatz@GARLIC.STANFORD.EDU (Morris Katz) In article <8911272329.AA07264@garlic.Stanford.EDU>, mkatz@GARLIC (Morris Katz) writes: >For symetry reasons, a language which supports multiple return values would >require two types of arity functions: call-arity and return-arity. (Please >don't flame about the names. I just hate using foo and bar as names when I >can think of something semantically more meaningful.) Call-arity is the >procedure which is more commonly called arity and returns information about >the number of parameters which a function expect. Return-arity is the >procedure which returns information about the number of return values to be >returned by a function. I think that RETURN-ARITY is not computable in enough cases to be worth having. First of all, anytime the returned value(s) come from a call to another function, RETURN-ARITY would have to descend through the call tree. Secondly, there is no assurance that every branch of a conditional will return the same number of arguments, so there will probably be a combinatorial blowup in descending this tree. Thirdly, and perhaps most obviously, the number of values that a function returns may only be specified at run-time (such as when they come from calling a passed in procedure, or when they vary according to the number or contents of passed-in arguments), in which case it is impossible to determine RETURN-ARITY altogether. Of course, the RETURN-ARITY could be given by a programmer as a declaration of some sort, and intelligent early-binding compilers could probably use this information to make better code, but this is a seperate issue and certainly can't be assumed to exist for all functions. Bruce Krulwich Institute for the Learning Sciences