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] |
Roland Orre <orre@nada.kth.se> writes: > I think it is time to consider a redefinition of "defined?" to > make it a special form. > > * defined? is still not standardized within the scheme standard > (thanks Bertrand!) which is a pity as it is an essential procedure > for everyone who tries to write code which is compatible between > different interpreters and versions of interpreters. > > * In the current guile definition defined? is a procedure which > evaluates its arguments. This is rather counterintuitive when > both "define" and "undefine" are special forms. Ok "undefine" is > not yet standardized either, but should be considered being > standardized in the scheme standard as well, as non essential. > Long running applications and shells etc need to be able to clean up. > > * For my own modules I have defined defined? to be a special form > to make it compatible with scm and when considering the > following answer on a request from > Ingo Hohmann <ingo.hohmann@gmx.de> > > Lalo Martins <lalo@webcom.com> wrote: > > (if (and (defined? a) (procedure? a)) > > #t > > (define (a) #t) > > ) > > It seems as there are more than I who prefer/expect defined? to be > a special form... Or it could've just been a typo ;). Reasons I can see to keep it as a procedure: 1) All r5rs predicates are defined as procedures. 2) It's closest standardized analogue is boundp in cl, which is defined in the same way. 3) Probably the most important, why add a special form when a procedure can serve just as well? It's pretty hard to forget after you screw it up once (and that probably wouldn't even be a problem with easily accessable documentation). In any case, having it as a special form makes other things a pita, like: (define funs-to-check '(this is a test)) (map (lambda (x) (if (not (defined? x)) (error "Required function not available"))) funs-to-check) -- Greg