- Subject: Re: [slang-users] try does not run require
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- Date: Mon, 12 Jun 2006 13:14:53 +0000 (UTC)
Hallo John,
"John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
> variable i;
> variable j = 0;
> for (i = 0; i < n; i++)
> {
> variable j;
> for (j = 0; j < M; j++) ...
> }
ACK. This is ugly. But if you specify that only global variables can be
overridden, because they are still accassable through Global->, than this
could not happen.
> and would be suprised to find that j is not 0 at the end of this code
> fragment. For this reason, slang flags the duplicate declaration of j
> as an error.
Right, because in your example a variable within the same namespace is
redefined in an inner scope. But an error in this example:
if (...)
{
variable i;
...
}
...
while (...)
{
if (...)
{
variable i;
}
}
is not really intuitive.
> But it only generates this error when the code occurs in a function.
> It does not do so for global variables, so that code such as
Which is IMO not really consistent.
Have a nice day, Jörg.
--
Roesen's Law (http://www.bruhaha.de/laws.html):
Sobald ein Troll, DAU oder Elch im Lauf eines Threads auf heftige Kritik
stößt, argumentiert er mit der Arroganz des Kritikers. Dies kann auch
vorsorglich erfolgen.
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]