When a variable has been declared it can’t really become undeclared.
Hmm. I'm not sure if this really qualifies as "undeclaring", but arguably, Rust departs from the ALGOL/Pascal/C model by having the compiler mark a variable inaccessible after it's been passed to a function etc.
There's also, in the general case, the situation where a variable is "captured" by a closure, resulting in its remaining accessible even when the original control flow has exited the scope relevant to its declaration (this obviously implies that the variable has to be allocated on the heap, even if that would not normally be indicated by its type).
(Please could somebody correct me if my understanding above is wrong).
I'm not really happy with the above cases, since IMO there's far more to be gained by teaching (and adhering to) a robustly-scoped and strongly-typed language such as Pascal or its close relatives than there is by inventing yet more "computer science crap".
But equally, I'm not happy with the situation which has been discussed ad-nauseam over the last week or so where a variable possibly /should/ be undeclared since its content can no longer be relied on if it has been a for loop's control variable.
MarkMLl