MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Compound Expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29190] Re: [mg29178] Compound Expressions
  • From: David Withoff <withoff at wolfram.com>
  • Date: Sat, 2 Jun 2001 05:54:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

> I see that the following is what Mathematica does, so it's clearly what 
> Mathematica does:
> 
>       In[147]:= a = 3; Remove["Global`*"]; a = 3; a
> 
>       Out[147]= 3
> 
>       In[148]:= a
> 
>       Out[148]= a
> 
>       In[149]:= a = 3; Remove["Global`*"]; Print[a]; a = 3; Print[a]
> 
>       From In[149]:= Removed["a"]
> 
>       From In[149]:= 3
> 
>       In[150]:= a
> 
>       Out[150]= a
> 
> What I don't understand is, not what Mathematica does here -- I'm not 
> interested in tracing out the details; I believe it happens --but *why* 
> the language would have to be designed to function in this (utterly 
> bizarre and utterly confusing) way?
> 
> To be more specific about this gripe:
> 
> *  The "Remove" expression clearly removes "a" immediately when it is 
> encountered, as the output of  In[149] in particular confirms.

The symbol "a" has already been encountered before it is removed.
It is perhaps also worth noting that the symbol "Remove" has been
encounted, since the computer obviously has to encounter and
recognize "Remove" before it can know that it is being asked to
remove something.  Similarly, "a" is not and cannot be removed immediately
when it is encountered, since at least a few such encounters have
to take place before the computer can know what it is being asked
to do. 

> *  The subsequent "a=3" expression then clearly recreates "a" and 
> assigns it a value *after* the "Remove" has been processed, as both 
> In[147] and In[149] confirm.

The subsequent "a=3" does not recreate "a".  The "a" was already
created when it was encountered when the computer looked at the
input to figure out what it was being asked to do.

To put the logical issue another way, suppose I send you a message
consisting of the single statement "Do not read this message", where
it is obviously impossible for you to do what was requested in the
message.

The computer has to process the input far enough to recognize
that it is being presented with a compound expression containing
various symbols and operations before it can know what it is being
asked to do. After completing that step the computer then proceeds
to do what it was asked to do, which in this example is to remove
a symbol and then assign a value to the removed symbol.

> So how does it make sense to have the "Remove" come back to life and 
> operate *again*, long after it should have been forgotten, so to speak?

Although the consequences of evaluating "Remove" certainly persist,
I'm not sure I see an interpretation of this behavior in which it
has come back to life.

> Does it *have* to be designed this way?

Yes.

I could add, however, that even though it impossible for the computer
to work otherwise, it is nevertheless an interesting problem, sort of
like time travel and perpetual motion. Considering possible alternative
designs, and understanding why they don't work, can be interesting and
instructive.

Dave Withoff
Wolfram Research


  • Prev by Date: Re: RSA and Fixed Exponents
  • Next by Date: multiplyin a symbol by 0
  • Previous by thread: Re: Compound Expressions
  • Next by thread: Re: Compound Expressions