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]

Re: Reintroducing old `defined?' (was Re: Testing availabilty of a procedure)


Marius Vollmer <mvo@zagadka.ping.de> writes:

> I agree about the semanticas, but not about the performance.  I think
> it should be memoizing when it finds a local binding.

OK.  In fact, with the new module system, we will introduce
"unmemoization" of memoized places when bindings change.  When this
mechanism is in place, we will be able to have a purely memoizing
`defined?'.

> > When a module is compiled, it is determined which bindings are
> > available.  Therefore the macro `defined?' can safely be expanded into
> > a boolean constant, which is easy for the compiler to treat in a
> > standard way.
> 
> Hmm, I think this contradicts your don't-memoize opinion above,
> doesn't it?

No.  When we compile a module, the set of available bindings should be
considered fixed.

> > This means that the compiler needs no special knowledge.
> 
> I think it needs special knowledge of `defined?' anyway because
> `defined?' is not a simple macro that expands into self-contained
> Scheme code.  The module/environment thing at compile-time is probably
> very different from the one used for the interpreter.  The compiler
> write should not be constrained to use the same representation for
> environments as the interpreter.

You're right that the current `defined?' macro uses knowledge about
the representation of bindings.  But doesn't this simply mean that the
compiler which uses a different representation can supply its own
version of the macro `defined?'?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]