Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.scheme Subject: Re: Why memq vs memv vs member, etc.? Message-ID: <1991May18.045823.9174@Think.COM> Date: 18 May 91 04:58:23 GMT References: <1991May15.172635.18635@Think.COM> Sender: news@Think.COM Reply-To: barmar@think.com Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 44 In article chip@soi.UUCP (Chip Morris) writes: >barmar@think.com (Barry Margolin) writes: >>I guess the only problem with optimizing out the explicit passing of >>the eq argument is that Scheme doesn't prohibit user programs from >>redefining standard procedure names as Common Lisp does. >Perhaps one must grudgingly admit an analysis advantage to Common >Lisp's otherwise distressingly assymetrical treatment of the function >position. Actually, in this case it has nothing to do with the special treatment of the function position. Users are prohibited from defining any symbol in the COMMON-LISP package as a function *or* a global, special variable (there's a list of about 25 things you aren't allowed to do to symbols in the COMMON-LISP package, so that implementations can call them internally and depend upon any implementation-specific behaviors of their own versions, and also to prevent applications from conflicting with each other by accidentally using the same symbols). >>And Schemers don't even have a valid excuse of "oh, the function position >>is special", because one of the fundamental tenets of Scheme is that the >>function position of a form is evaluated just like other positions. > >I think that a Schemer's valid excuse should be "oh, my program >doesn't change the meaning of EQ, CAR, etc." And maybe s/he should be >able to rely on analysis tools to assert this to a compiler in the >bulk of cases where it can be deduced. But it frequently can't be deduced statically. Any call to load (or eval, in implementations that have it) can potentially redefine any procedure name. The compiler has no way of knowing whether such a file will be loaded into the same environment as the file currently being compiled. >To consider another example, isn't Scheme's somewhat unbridled >treatment of first-class continuations something of an analysis >nightmare? Yes, but it is possible to analyze many of these cases statically. A static analyzer can detect when a procedure *is* redefined, but it rarely can determine that a procedure *won't* be redefined. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar