Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!uwvax!daffy!saavik.cs.wisc.edu!quale From: quale@saavik.cs.wisc.edu (Douglas E. Quale) Newsgroups: comp.lang.scheme Subject: Re: evaluating () should be an error Message-ID: <1991Mar26.155905.12906@daffy.cs.wisc.edu> Date: 26 Mar 91 15:59:05 GMT References: <1991Mar24.064144.4256@daffy.cs.wisc.edu> <2977@kraftbus.cs.tu-berlin.de> Sender: news@daffy.cs.wisc.edu (The News) Organization: University of Wisconsin -- Madison Lines: 35 In article <2977@kraftbus.cs.tu-berlin.de> net@opal.cs.tu-berlin.de (Oliver Laumann) writes: >In article <1991Mar24.064144.4256@daffy.cs.wisc.edu> quale@saavik.cs.wisc.edu (Douglas E. Quale) writes: >> IMHO, an attempt to evaluate () should be required by the standard to signal >> an error. This would clean up a bit of lazy coding by forcing the use of '(). > >I thought the standard did require () to be quoted. The P1178/D4 says >(section 4.1.3, page 15): > > "Note: In many dialects of Lisp, the empty combination, (), > is a legitimate expression. In Scheme, combinations must > have at least one subexpression, so () is not a syntactitcally > valid expression." > The Scheme standards say that evaluating () is an error, but they don't require implementations to report it. I'm glad Elk catches this, because I think it's The Right Thing to do. Although these checks can slow down interpreters, there's no excuse for a compiler not to catch this. Re: using values returned by set! et al mentioned in a previous post I've never seen any Scheme code that depended on the value returned by set!, but it would be easy to make this mistake. Some Schemes return something like #[undefined value] for these cases. Although not defining the return values of these functions can enable a compiler to generate faster code, I think it would be better to define return values for them. The return values wouldn't be used very frequently and often the compiler can see this and generate the same code as if the return value were undefined. Of course going to far in this direction might lead to specifying the evaluation order of arguments to procedures, and I don't think that would be good. -- Doug Quale quale@picard.cs.wisc.edu