This is the mail archive of the 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?'

>>>>> "Roland" == Roland Orre <> writes:

    Roland> I think it is time to consider a redefinition of "defined?" to
    Roland> make it a special form.

I'm not sure this is really an objection, but if "defined?" becomes a
special form, it becomes more difficult to check if a variable holds a
symbol that is defined.

    Roland> * defined? is still not standardized within the scheme standard
    Roland> (thanks Bertrand!) which is a pity as it is an essential
    Roland> procedure for everyone who tries to write code which is
    Roland> compatible between different interpreters and versions of
    Roland> interpreters.

Perhaps this is a good place for a SRFI.

    Keith> Why would you want a dynamic test of whether
    Keith> a variable is defined?  Did you not write the program?

In reasonably large systems where stuff is dynamically loaded and
unloaded, you didn't write the program.  It's being written as it
runs.  Without a procedure like defined? it is difficult to query the
state of the system when the program adds new code.

    Keith> The Garbage Collector cleans up storage.  Long running
    Keith> applications do not typically use up variables as they run;

Long running interactive applications and long running hardware
control applications often do.  It's very nice to be able to
completely remove all traces of some code from a system.

    Keith> The only use I see for
    Keith> UNDEFINE is during interactive development when you
    Keith> discover you have made a boo-boo.  Even then it doesn't do
    Keith> much that couldn't be done by (define boo-boo #f).

For certain types of applications polution of the namespace is as bad
as unclaimed memory.  And, in an interpreter a defined symbols do
require space even if it they are not attached to a value.
    Keith> I see DEFINED? as analogous to EVAL.  For certain special
    Keith> purposes (_not_ in ordinary applications) it is useful to
    Keith> treat lists of symbols as programs.

You're "special purpose" may be my "ordinary".  That's not an argument
to exclude "DEFINED?".