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?'


Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:
>Keith Wright <kwright@tiac.net> writes:
>>>                                                     Ok "undefine" is
>>>   not yet standardized either, but should be considered being
>>>   standardized in the scheme standard as well, as non essential.
>
Jost> Does r5rs mention `undefine' at all?  I don't like undefine because
Jost> it is hard to implement:
Jost>
Jost> (define (b) (display a))
Jost> (define a 12)
Jost> (b)                        -> 12
Jost>
Jost> (undefine a)
Jost> a                          -> ERROR
Jost> (b)                        -> value "undefined"
Jost>                              ^^^^^^^^^^^^^^^^^ WRONG!
Jost>
Jost>
Jost> So I think it would be better to drop `undefine' completely.  

Are you really serious with kind of example :-) ?

You try to tell me that by using a certain procedure you can get
errors on the command line when you are playing with the interpreter?

With that kind of argumentation we can skip any kind of powerful
functions, just because if you don't understand what they are doing
you can get errors.

I would say that your example above is merely a rather intuitive way
of explaining what undefine does, and you mention implementation.
Well the undefine code is not more than about 30 lines of straight
forward code. I would not consider that as hard to implement...

Jost>
Jost>> DEFINED?
Jost>
Jost> Doesn't `(environment-bound? (car (the-environment)) <sym>)' do what
Jost> you want?  (See Jim Blandy's environment proposal).

Would you really consider that to be a good portable way to check for
defined variables in different scheme implementations ?
(and if it is, why not call it defined? then...)

Keith Wright <kwright@tiac.net> writes:

Keith> There is no mention of "special forms" in RnRS, I assume you mean
Keith> that you want (defined? x) rather than (defined? 'x).

Yes, since I first learned scheme 14 years ago, not by reading the
scheme report, but instead reading the now classical book by
Abelson, Sussman and Sussman all functions in scheme are procedures
except some "special forms" which does not evaluate their arguments,
like define,if,case,cond,or etc.

Keith Wright <kwright@tiac.net> also wrote:
Keith> The Garbage Collector cleans up storage.  Long running applications
Keith> do not typically use up variables as they run; there is a fixed
Keith> set set of them defined in the text of the program, which does not
Keith> change.  The only use I see for UNDEFINE is during interactive
Keith> development when you discover you have made a boo-boo.  Even then
Keith> it doesn't do much that couldn't be done by (define boo-boo #f).

With your argument you are exactly telling me the opposite thing that
when being at the command line I don't need UNDEFINE, because there
I can of course just simply do as you suggest  (define boo-boo #f)
(often I do just that to save some houndred megs of memory stored in some
array for instance, before I allocate some huge amounts of memory again.)

It is when running long applications that can go on for weeks, months
years (if not on a Windoze machine of course...) you really need
to be able to clean up some code, like loaded procedures etc when
you know that you will never use them again. 

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

You should be aware that anything which is defined at top-level
in scheme lives for ever, it can not be garbage collected without
first having made sure that the user or application will never
reference it longer. The only one who knows about this is the
user or the application. A mind reading, future predicting,
garbage collector would possibly do it, under certain circumtances.

Clark McGrew <mcgrew@ale.physics.sunysb.edu> expressed it in this
nice way:
> " 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."

I think we should be aware about that what we are trying to do
now is a workhorse, a program language to write up applications
in. Scheme is a very pure language as it is close to lambda-
calculus but I would claim that pure lambda calculus would
never be a big hit in the application area..

I consider guile as a new versatile but still understandable
environment for really making applications in. Since 4 years back
I use guile as the basis for my applications. As an applied
user you want the language to serve your needs and here you
come to issues where e.g. (defined?) is completely essential
as you most likely want to make code that can run in more than
a very tight closed toy environment. 

The goal with guile, as I see it, is to make a langauge which
has all the power you need but still be as simple as possible,
but not too simple, then it would not be simple to use.

	Best regards
	Roland Orre


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