473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

local/global scope confusion

Hi group,

Consider this simple script (tested on FF3):

<script type="text/javascript">
test = 'outer';
for (var i=0;i<2;i++){
alert(test);
var test = 'inner';
alert (test);
}
alert (test);
</script>
I expected it would alert:
(i==0): outer inner
(i==1): ???? inner
(after loop): outer

I was just curious and wondered what the ???? would be.
(It turns out that it is inner.)

But what surprised me most was that the last alert, the one after the
forloop, also gave me 'inner'.
So it looks like declaring my local test variable affects the global
test variable. I don't get that.

Can anybody clarify to me why this happens?
I must be missing something.

TIA!

Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
Nov 12 '08 #1
27 1653
Erwin Moller meinte:
Hi group,

Consider this simple script (tested on FF3):

<script type="text/javascript">
test = 'outer';
for (var i=0;i<2;i++){
alert(test);
var test = 'inner';
alert (test);
}
alert (test);
</script>
I expected it would alert:
(i==0): outer inner
(i==1): ???? inner
(after loop): outer

I was just curious and wondered what the ???? would be.
(It turns out that it is inner.)
JavaScript has function scope, not block scope. (Future versions of
ECMAScript might allow block scoping, though.)
But what surprised me most was that the last alert, the one after the
forloop, also gave me 'inner'.
So it looks like declaring my local test variable affects the global
test variable. I don't get that.
Since you are always in the same scope, you are always working with the
same variable.
Can anybody clarify to me why this happens?
I must be missing something.
Yes. There is no block scope in the current versions of JavaScript.

Gregor
Nov 12 '08 #2
Gregor Kofler schreef:
Erwin Moller meinte:
>Hi group,

Consider this simple script (tested on FF3):

<script type="text/javascript">
test = 'outer';
for (var i=0;i<2;i++){
alert(test);
var test = 'inner';
alert (test);
}
alert (test);
</script>
I expected it would alert:
(i==0): outer inner
(i==1): ???? inner
(after loop): outer

I was just curious and wondered what the ???? would be.
(It turns out that it is inner.)

JavaScript has function scope, not block scope. (Future versions of
ECMAScript might allow block scoping, though.)
>But what surprised me most was that the last alert, the one after the
forloop, also gave me 'inner'.
So it looks like declaring my local test variable affects the global
test variable. I don't get that.

Since you are always in the same scope, you are always working with the
same variable.
>Can anybody clarify to me why this happens?
I must be missing something.

Yes. There is no block scope in the current versions of JavaScript.

Gregor
Thanks Gregor.

I wonder why I never noticed in all the years I use JavaScript. ;-)
/me goes shoot himself.

The following script clearly shows what you said.

<script type="text/javascript">
var test = 'outer';
function aFunc(){
alert(test);
for (var i=0;i<2;i++){
var test = 'inner';
alert (test);
}
}
aFunc();
alert (test);
</script>

gives: undefined, inner, inner, outer.
As expected (once you know there is no block scope in current JavaScript).

Thanks.

Regards,
Erwin Moller
--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
Nov 12 '08 #3
Gregor Kofler wrote:
There is no block scope in the current versions of JavaScript.
ECMAScript does not have it, but Mozilla's JavaScript has block scope
since version 1.7 with let, see
https://developer.mozilla.org/en/New...scope_with_let
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '08 #4
On 2008-11-12 11:12, Gregor Kofler wrote:
JavaScript has function scope, not block scope.
There is one minor exception to this rule (no pun inteded):

var test = "outer";
alert(test); // outer
try {
throw "inner";
} catch (test) {
alert(test); // inner
}
alert(test); // outer
- Conrad
Nov 12 '08 #5
"Erwin Moller"
<Si******************************************@spam yourself.comwrote in
message news:49*********************@news.xs4all.nl...
>
The following script clearly shows what you said.

<script type="text/javascript">
var test = 'outer';
function aFunc(){
alert(test);
for (var i=0;i<2;i++){
var test = 'inner';
alert (test);
}
}
aFunc();
alert (test);
</script>

gives: undefined, inner, inner, outer.
As expected (once you know there is no block scope in current JavaScript).

Thanks.

Regards,
Erwin Moller
I thought I understood the scoping of JavaScript, but now I don't

So a variable declared and modified outside a function is not known inside
the function ?
But if a variable is declared and modified outside a function, it can be
modified inside the function and its value is then known outside the
function ??

For example
<script type="text/javascript">
var test1 = 'outer1'; var test2 = 'outer2';
alert('test1 ' + test1); alert('test2 ' + test2);

function aFunc(){
alert('test1 ' + test1); alert('test2 ' + test2);
for (var i=0;i<2;i++){
var test1 = 'inner1';
test2 = 'inner2';
alert('test1 ' + test1); alert('test2 ' + test2);
}
}
aFunc();
alert('test1 ' + test1);alert('test2 ' + test2);
</script>

gives these alerts
test1 outer1 ]
test2 outer2 ] Outside function

test1 undefined ]
test2 outer2 ] Inside function - before loop

test1 inner1 ]
test2 inner2 ] Inside function - inside loop

test1 inner1 ]
test2 inner2 ] Inside function - inside loop

test1 outer1 ]
test2 inner2 ] Outside function

Why is the variable test1 undefined at the start ?

Is the function parsed before being executed so that JS knows that test1 is
local, but is not actually defined until a line or so later?

BTW,
I may be that some explanations of the *meaning* of block scope and function
scope could be useful here, and not just "JavaScript does not have block
scope"
--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org
Nov 16 '08 #6
Trevor Lawrence wrote on 16 nov 2008 in comp.lang.javascript:
I thought I understood the scoping of JavaScript, but now I don't

So a variable declared and modified outside a function is not known
inside the function ?
No, and Yes:

A variable declared outside a function is not known inside the function,
only if a variable with the same name is declared inside that function.

Javascript is not a linear parser, the parsing can be thougt of as a two
phase process. In the first phase the names of variables and functions
are defined with their scope, the second phase is the execution.

[In fact the first phase probably also makes and optimizes an
intermediate code.]

The modification has nothing to do with is, but identifing these facts in
your test.

There are two different variables in the below code, both are named a.
One has a global scope, the othe a scope local to f1().

<script type="text/javascript">

var a = 1;

document.write('<br>' + a); // 1 [global a]

function f1(){
document.write('<br>' + a); // 1 [global a]
};

function f2(){
document.write('<br>' + a); // undefined [local scope a]
var a = 2;
document.write('<br>' + a); // 2 [local scope a]
};

f1();
f2();
f1(); // 1 [global a]

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 16 '08 #7
On Nov 16, 7:34*am, "Trevor Lawrence" <Trevor L.@Canberrawrote:
>
Is the function parsed before being executed so that JS knows that test1 is
local, but is not actually defined until a line or so later?
Yes, that's it.

--
Jorge.
Nov 16 '08 #8
Thanks Evertjan and Jorge
Your answers gave precisely the info. I needed, even though my question may
have been a little unclear.

I have noticed that many other replies in this NG have not been as polite
and helpful

--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org

"Jorge" <jo***@jorgechamorro.comwrote in message
news:00**********************************@v39g2000 pro.googlegroups.com...
On Nov 16, 7:34 am, "Trevor Lawrence" <Trevor L.@Canberrawrote:
>
Is the function parsed before being executed so that JS knows that test1
is
local, but is not actually defined until a line or so later?
Yes, that's it.

--
Jorge.
Nov 17 '08 #9
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
The DOM is very weird.
The DOM is not part of Javascript.

Perhaps you mean the DOM-Javascript interface, but in IE that is the same
one as the DOM-VBS interface, so not Javascript specific.

<INPUT type FILEstuff is an abortion with respect to styling..
An abortion?
An abomination perhaps, but this does not touch Javascript at all.

Better switch to an HTML NG.

;-)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 17 '08 #10
Evertjan. wrote:
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>The DOM is very weird.

The DOM is not part of Javascript.

Perhaps you mean the DOM-Javascript interface, but in IE that is the same
one as the DOM-VBS interface, so not Javascript specific.
Yup. See what I mean? where does the DOM stop and javashite begin?
>
><INPUT type FILEstuff is an abortion with respect to styling..

An abortion?
An abomination perhaps, but this does not touch Javascript at all.

Better switch to an HTML NG.
see point above. Why doesn't javascript have PROPER access to these
elements?

;-)
Indeed...
Nov 17 '08 #11
The Natural Philosopher <a@b.cwrites:
Evertjan. wrote:
>The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>><INPUT type FILEstuff is an abortion with respect to styling..
see point above. Why doesn't javascript have PROPER access to these
elements?
Because that would be incredibly stupid.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Nov 17 '08 #12
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
Evertjan. wrote:
>The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>>The DOM is very weird.

The DOM is not part of Javascript.

Perhaps you mean the DOM-Javascript interface, but in IE that is the
same one as the DOM-VBS interface, so not Javascript specific.

Yup. See what I mean? where does the DOM stop and javashite begin?
Where does the land stop, and the sea begin?

Javascript is a far more general language than a clientside browser one.

Don't blame the German language for Hitler's behavour.
[Though I often would like to]

The DOM was not invented to accomodate Javascript.
>><INPUT type FILEstuff is an abortion with respect to styling..

An abortion?
An abomination perhaps, but this does not touch Javascript at all.

Better switch to an HTML NG.

see point above. Why doesn't javascript have PROPER access to these
elements?
Because the browser does not provide it, not a Javascript issue, but a
sensible one securitywize.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 17 '08 #13
Evertjan. wrote:
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>Evertjan. wrote:
>>The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
The DOM is very weird.
The DOM is not part of Javascript.

Perhaps you mean the DOM-Javascript interface, but in IE that is the
same one as the DOM-VBS interface, so not Javascript specific.
Yup. See what I mean? where does the DOM stop and javashite begin?

Where does the land stop, and the sea begin?

Javascript is a far more general language than a clientside browser one.

Don't blame the German language for Hitler's behavour.
[Though I often would like to]

The DOM was not invented to accomodate Javascript.
>>><INPUT type FILEstuff is an abortion with respect to styling..
An abortion?
An abomination perhaps, but this does not touch Javascript at all.

Better switch to an HTML NG.
see point above. Why doesn't javascript have PROPER access to these
elements?

Because the browser does not provide it, not a Javascript issue, but a
sensible one securitywize.
Theres a difference between being able to determine attributes of style,
and being able to rob the user of his files...

>
Nov 17 '08 #14
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>>see point above. Why doesn't javascript have PROPER access to these
elements?

Because the browser does not provide it, not a Javascript issue, but a
sensible one securitywize.

Theres a difference between being able to determine attributes of style,
and being able to rob the user of his files...
Style is not Javascript, you could try CSS, but do reply in a PROPER NG.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 17 '08 #15
Evertjan. wrote:
The Natural Philosopher wrote on 17 nov 2008 in comp.lang.javascript:
>>>see point above. Why doesn't javascript have PROPER access to these
elements?
Because the browser does not provide it, not a Javascript issue, but a
sensible one securitywize.
Theres a difference between being able to determine attributes of style,
and being able to rob the user of his files...

Style is not Javascript, you could try CSS, but do reply in a PROPER NG.
such a nice friendly group. Just like the language.

Nov 17 '08 #16
The Natural Philosopher <a@b.cwrites:
such a nice friendly group. Just like the language.
Oh shut up.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Nov 17 '08 #17
On Nov 17, 11:22*am, The Natural Philosopher <a...@b.cwrote:
Trevor Lawrence wrote:
Thanks Evertjan and Jorge
Your answers gave precisely the info. I needed, even though my questionmay
have been a little unclear.
I have noticed that many other replies in this NG have not been as polite
and helpful

One of the reasons I don't normally hang out here.

There are two people who actually really help..Erwin Moller is one, and
I forget the other..

There are about 3-4 who try, but often don't really understand the problem.

The rest are probably here because they can't actually write javascript,
(IMHO an entirely reasonable thing) but like to think they can (entirely
unreasonable !)
Yeah, the normal, the abnormal and the ones who imitate the abnormal.
Normal people would never dare to spit in the first place, in the face
of someone whom you don't know at all an "are you too lazy or too
stupid ?". That's absolutely disrespectful and crude and inexcusable
and abnormal. Sure, not big enough eggs to behave so face to face, but
parapeted far away behind the network... in a word: a psychopathology.

--
Jorge.
Nov 17 '08 #18
Jorge wrote:
On Nov 17, 11:22 am, The Natural Philosopher <a...@b.cwrote:
>Trevor Lawrence wrote:
>>Thanks Evertjan and Jorge
Your answers gave precisely the info. I needed, even though my question may
have been a little unclear.
I have noticed that many other replies in this NG have not been as polite
and helpful
One of the reasons I don't normally hang out here.

There are two people who actually really help..Erwin Moller is one, and
I forget the other..

There are about 3-4 who try, but often don't really understand the problem.

The rest are probably here because they can't actually write javascript,
(IMHO an entirely reasonable thing) but like to think they can (entirely
unreasonable !)

Yeah, the normal, the abnormal and the ones who imitate the abnormal.
Normal people would never dare to spit in the first place, in the face
of someone whom you don't know at all an "are you too lazy or too
stupid ?". That's absolutely disrespectful and crude and inexcusable
and abnormal. Sure, not big enough eggs to behave so face to face, but
parapeted far away behind the network... in a word: a psychopathology.
I remember the days of Usenet, when you would, via a 9600 modem,ask.

"how the heck to I get my printer working on Sys4 Unix?

and somebody would cut and paste or retype - the appropriate config from
their working setup.

bandwidth was almpost to low for abuse, as were latencies..to high.

Of course we are ignorant: that's why we are asking.

Lazy and stupid?..not many.
--
Jorge.
Nov 17 '08 #19
On Nov 17, 10:46*am, Joost Diepenmaat <jo...@zeekat.nlwrote:
The Natural Philosopher <a...@b.cwrites:
such a nice friendly group. Just like the language.

Oh shut up.
Let's not feed the troll.
>
--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
--
kangax
Nov 17 '08 #20
The Natural Philosopher wrote:
>
I remember the days of Usenet,
.... which obviously have not ended, since this is posted to a Usenet
newsgroup ...
when you would, via a 9600 modem,
I assume that means a modem running in a 9600 bps mode. I'm sure
plenty of us remember reading Usenet over slower connections. I read
Usenet from shell accounts over 1200 bps async dialup connections, and
I'm not an old-timer by Usenet standards.
>ask.

"how the heck to I get my printer working on Sys4 Unix?
That would be an odd question, since UNIX System IV was never
released. Perhaps you're thinking of System V Release 4 (SVR4).
bandwidth was almpost to low for abuse, as were latencies..to high.
As with most argumentum ad verecundiam, this narrative is more fantasy
than history. The prelapsarian age of Usenet, before "abuse" of
various sorts, certainly had ended before 9600 bps async modems were
widely available. ITU v.29 was issued in 1988. By that time we had
*parodies* of abuse on Usenet - Joe Talmadge created "BIFF" in 1988,
according to the net.legends FAQ.

A few minutes' research would have shown that. But I suppose argument
from personal anecdote is the preferred technique of natural philosophy.
Of course we are ignorant: that's why we are asking.
That's no reason to be arrogant, insulting, presumptuous, and prone to
posting inane and spurious generalizations, as in "there are two
people who actually really help" or "the rest are probably here
because they can't actually write javascript".

Those sins are forgivable, to an extent, in those who are both experts
(because they provide value) and regulars (because they've
demonstrated their willingness to continue participating in the
discussion). Tourists have no such excuse.

--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University
Nov 17 '08 #21
Well, I started the discussion on being helpful, but I don't want to
continue it

What I don't understand is the statement "this is posted to a Usenet
newsgroup ..."

So far as I know, this is just another NG. I first started corresponding on
the msnews NGs and then later on a private group. However, I was informed on
one NG that c.l.j. is more relevant to Javascript.
What makes c.l.j. different?
Are there Usenet NGs and non-Usenet NGs?

--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org

"Michael Wojcik" <mw*****@newsguy.comwrote in message
news:gf*********@news3.newsguy.com...
The Natural Philosopher wrote:
>>
I remember the days of Usenet,

... which obviously have not ended, since this is posted to a Usenet
newsgroup ...
>when you would, via a 9600 modem,

I assume that means a modem running in a 9600 bps mode. I'm sure
plenty of us remember reading Usenet over slower connections. I read
Usenet from shell accounts over 1200 bps async dialup connections, and
I'm not an old-timer by Usenet standards.
>>ask.

"how the heck to I get my printer working on Sys4 Unix?

That would be an odd question, since UNIX System IV was never
released. Perhaps you're thinking of System V Release 4 (SVR4).
>bandwidth was almpost to low for abuse, as were latencies..to high.

As with most argumentum ad verecundiam, this narrative is more fantasy
than history. The prelapsarian age of Usenet, before "abuse" of
various sorts, certainly had ended before 9600 bps async modems were
widely available. ITU v.29 was issued in 1988. By that time we had
*parodies* of abuse on Usenet - Joe Talmadge created "BIFF" in 1988,
according to the net.legends FAQ.

A few minutes' research would have shown that. But I suppose argument
from personal anecdote is the preferred technique of natural philosophy.
>Of course we are ignorant: that's why we are asking.

That's no reason to be arrogant, insulting, presumptuous, and prone to
posting inane and spurious generalizations, as in "there are two
people who actually really help" or "the rest are probably here
because they can't actually write javascript".

Those sins are forgivable, to an extent, in those who are both experts
(because they provide value) and regulars (because they've
demonstrated their willingness to continue participating in the
discussion). Tourists have no such excuse.

--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University

Nov 18 '08 #22
On Tue, 18 Nov 2008 00:41:40 +0000, Trevor Lawrence wrote:
[...]
Are there Usenet NGs and non-Usenet NGs?
Yes. Ask your favourite search engine for "Usenet" and "NNTP" (which is
the protocol used to distribute the news). And lookup the <news.answers>
group for FAQs regarding your question.

In contrast to the freely and worldwide distributed newsgroups (with
thousands of peering newsservers around the globe) there are lot of groups
hosted by a single news provider (e.g. an organisation {like Eclipse} or a
commercial company {like Google} or anybody else who likes to do so) where
the respective newsgroups are available only for readers directly
connected with that very news host.

A third class of NGs you could call "pseudo groups": Initially mailing
lists (with individual members mailing to the list) someone converts
those emails to newsgroup messages (for example mail to the
<de****************@lists.debian.orgmailing list is gated to the
<linux.debian.user.germannewsgroup which in turn might be available
at some Usenet newsservers.

It might seem a bit confusing at first glance, but once you've got the
hang of it (and a decent newsreader) it's quite easy. But, anyway, this
is clearly off-topic in _this_ newsgroup, hence you should look for a
newsgroup more appropriate to discuss your questions about how the
Usenet works.
--
Matthias
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST M$ ATTACHMENTS
/ \
Nov 18 '08 #23
Trevor Lawrence wrote:
Well, I started the discussion on being helpful, but I don't want to
continue it

What I don't understand is the statement "this is posted to a Usenet
newsgroup ..."

So far as I know, this is just another NG. I first started corresponding on
the msnews NGs and then later on a private group. However, I was informed on
one NG that c.l.j. is more relevant to Javascript.
What makes c.l.j. different?
Are there Usenet NGs and non-Usenet NGs?
No. its all Usenet, except no one calls it that any more.

Nov 18 '08 #24
The Natural Philosopher wrote:
Trevor Lawrence wrote:
>Well, I started the discussion on being helpful, but I don't want to
continue it

What I don't understand is the statement "this is posted to a Usenet
newsgroup ..."

So far as I know, this is just another NG. I first started
corresponding on the msnews NGs and then later on a private group.
However, I was informed on one NG that c.l.j. is more relevant to
Javascript.
What makes c.l.j. different?
Are there Usenet NGs and non-Usenet NGs?
No. its all Usenet, except no one calls it that any more.
According to some, USENET is restricted to the Big 8.

And note that all public newsgroups are Google Groups, but not all
Google Groups are newsgroups.
--
John W. Kennedy
"The whole modern world has divided itself into Conservatives and
Progressives. The business of Progressives is to go on making mistakes.
The business of the Conservatives is to prevent the mistakes from being
corrected."
-- G. K. Chesterton
Nov 18 '08 #25
"David Mark" <dm***********@gmail.comwrote in message
news:57**********************************@c22g2000 prc.googlegroups.com...
On Nov 17, 5:22 am, The Natural Philosopher <a...@b.cwrote:
Trevor Lawrence wrote:
Thanks Evertjan and Jorge
Your answers gave precisely the info. I needed, even though my question
may
have been a little unclear.
I have noticed that many other replies in this NG have not been as
polite
and helpful

One of the reasons I don't normally hang out here.

[snip]
There was lots of rambling here

My question is
What is your problem ?
If someone gives a reasonable answer, then why does it need to be pull apart
and dissected? (I think l am being tautologous here.)

--
Trevor Lawrence
Canberra
Web Site http://trevorl.mvps.org

Nov 19 '08 #26
On Nov 19, 1:30*am, "Trevor Lawrence" <Trevor L.@Canberrawrote:
"David Mark" <dmark.cins...@gmail.comwrote in message

news:57**********************************@c22g2000 prc.googlegroups.com...
On Nov 17, 5:22 am, The Natural Philosopher <a...@b.cwrote:
Trevor Lawrence wrote:
Thanks Evertjan and Jorge
Your answers gave precisely the info. I needed, even though my question
may
have been a little unclear.
I have noticed that many other replies in this NG have not been as
polite
and helpful
One of the reasons I don't normally hang out here.
[snip]

There was lots of rambling here

My question is
What is your problem ?
Hard to tell what you are referring to from what you quoted. I was
talking to "The Natural Philosopher", who answered nothing.
If someone gives a reasonable answer, then why does it need to be pull apart
and dissected? (I think l am being tautologous here.)
I think you misread something.
Nov 19 '08 #27
In comp.lang.javascript message <49**********************@cv.net>, Tue,
18 Nov 2008 12:07:08, John W Kennedy <jw*****@attglobal.netposted:
>
And note that all public newsgroups are Google Groups, but not all
Google Groups are newsgroups.
IMHO, it would be wiser to use the term "Google Groups" to refer only to
those residing only at Google, although not to rely on others doing
likewise.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Nov 19 '08 #28

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable...
5
by: A | last post by:
Hi, Consider this code: //Header File - Foo.h int i = 0; // non-static global variable class Foo{ ...
23
by: Timothy Madden | last post by:
Hello all. I program C++ since a lot of time now and I still don't know this simple thing: what's the problem with local functions so they are not part of C++ ? There surely are many people...
4
by: shilpa | last post by:
Hi, I just wanted to know whether we can access global variable within a local block , where both variables are having same name. For ex: int temp=5 ; { int temp=10;
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
8
by: Sullivan WxPyQtKinter | last post by:
I am confused by the following program: def f(): print x x=12345 f() result is: 12345
4
by: subramanian100in | last post by:
I read in C++ Primer 4th Edition by Stanley Lippman, in page 57, that const variables at global scope are local to a file by default. What is the advantage of this rule ? Suppose I have the...
2
by: Matt Nordhoff | last post by:
Sebastjan Trepca wrote: Python doesn't like when you read a variable that exists in an outer scope, then try to assign to it in this scope. (When you do "a = b", "b" is processed first. In...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.