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] |
>I found the following problem when installing SLaTeX. In SCM version >4e1, we have > > (defined? defined?) > #t > > (defined? 'defined?) > #f >while in Guile 1.3a.pre2 the same code yields > >(defined? defined?) > ERROR: In procedure defined? in expression (defined? defined?): > ERROR: Wrong type argument in position 1: #<primitive-procedure defined?> > ABORT: (wrong-type-arg) > > Type "(backtrace)" to get more information. > >(defined? 'defined?) > #t > >This can't be deliberate decision, can it? A semi-deliberate decision, if I recall correctly. There's been some debate as to what DEFINED? should mean, especially in the presence of first-class modules, where bindings might go away over time. There are two consistent definitions I can think of: 1) DEFINED? should be a procedure, which takes an environment value (e.g., a module object) and a symbol, and tells you whether that symbol is bound in that environment. This is certainly a well-defined question. 2) DEFINED? should be a core syntactic form --- not even a macro --- which is true if its operand, a symbol, is bound in the current environment. Thus: (defined? car) => #t (defined? quote) => #t (defined? defined?) => #t (defined? snodgrass) => #f ; take my word for it (let ((snodgrass 'mom)) (defined? snodgrass)) => #t Note that defined? is not a constant expression, and cannot be replaced by one at macro-expansion time. (define (foo) (defined? bar)) (foo) => #f (define bar 'zoot) (foo) => #t I can't find the root of the original discussion, but I think we changed it because it implemented something bogus (e.g., always consulting the "top-level" environment). If anyone can remember, please let me know. Is definition 1) above consistent with SCM's behavior?