Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38829 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2020-09-23 00:16 -0700 |
| Last post | 2020-09-26 11:05 -0700 |
| Articles | 17 on this page of 37 — 8 participants |
Back to article view | Back to comp.lang.javascript
Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 00:16 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 00:31 -0700
Re: Stop the mouse listener JJ <jj4public@gmail.com> - 2020-09-23 18:49 +0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 05:42 -0700
Re: Stop the mouse listener Silvio <silvio@internet.com> - 2020-09-23 20:25 +0200
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 15:22 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 15:31 -0700
Re: Stop the mouse listener Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 10:14 +0200
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:38 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:45 -0700
Re: Stop the mouse listener Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 19:43 +0200
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:42 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:52 -0700
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 08:32 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 08:59 -0700
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 09:08 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 09:25 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 09:09 -0700
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 09:53 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 10:00 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 10:02 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 13:10 -0700
Re: Stop the mouse listener "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-25 13:43 +0200
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-25 08:44 -0700
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-24 11:28 -0700
Re: Stop the mouse listener Silvio <silvio@internet.com> - 2020-09-24 23:19 +0200
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-24 14:51 -0700
Re: Stop the mouse listener John G Harris <niam@jghnorth.org.uk.invalid> - 2020-09-25 11:15 +0100
Re: Stop the mouse listener "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-25 13:31 +0200
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-25 11:01 -0700
Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-25 11:06 -0700
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-25 11:15 -0700
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:41 -0700
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:46 -0700
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:33 -0700
Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-26 09:32 -0700
Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 11:05 -0700
Page 2 of 2 — ← Prev page 1 [2]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-09-24 10:02 -0700 |
| Message-ID | <3c1f5763-4853-4a10-a88a-9067b5d79e60o@googlegroups.com> |
| In reply to | #38848 |
Den torsdag 24 september 2020 kl. 19:01:01 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 24 september 2020 kl. 18:53:46 UTC+2 skrev luserdroog:
> > On Thursday, September 24, 2020 at 11:09:49 AM UTC-5, Jonas Thörnvall wrote:
> > > Den torsdag 24 september 2020 kl. 18:00:06 UTC+2 skrev Jonas Thörnvall:
> > > > Den torsdag 24 september 2020 kl. 17:32:29 UTC+2 skrev luserdroog:
> > > > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall wrote:
> > > > > >
> > > > > > Could i have
> > > > > > c = document.getElementById("myCanvas");
> > > > > > ctm = c.getContext("2d");
> > > > > >
> > > > > > in a function or should they also just flap in the breeze, and must that breeze be in the same file as mouselistener?
> > > > > >
> > > > > > Because evidently the file with event mousecode do not reach "c" flapping in the wind.
> > > > >
> > > > > Sure, it can be in a function. Since you're not using `var` or `let`
> > > > > or `const`, then c and ctm will have global scope. So as soon as the
> > > > > function is called, these variables should be defined.
> > > >
> > > > Well it seem they are not, i get message not defined could it be they rest in another file? I am pretty sure i got the file order so that c and ctm load before eventhandler for mouse, i did put them in the first SRC file with the function called directly from HTML at load.
> > > >
> > > > But i get c is not defined, and it is c i should refer to the document canvas object, ctm is just properties/context of it?
> > >
> > > This is the errorcode i get.
> > > Uncaught ReferenceError: c is not defined
> > > at mouse.js:29
> > >
> > >
> > > //These are in game engine does not matter inside early called function, or just flapping around in file.
> > > c = document.getElementById("myCanvas");
> > > ctm = c.getContext("2d");
> > >
> >
> > I tried peeking through your github files, but I couldn't find
> > these lines in any of the files I looked at.
> >
> > If it's at the top level (ie. flappin in the breeze) then it
> > must be in a file that's loaded earlier than the one where
> > you use it (or earlier than any calls to functions that might
> > use it. Could it be that you're editing multiple files at once
> > and maybe occasionally forgetting to save one before testing?
> >
> > BTW, 'c' probably isn't the greatest name to use for
> > a global variable.
>
> Honestly i can't be bothered with syntax that do not make sense. Maybe it was a bad idea to drop the listener anyway i just set a boolean for the mouse down call.
Solved....
if(locked==false){ mousedown_logic();} else {}
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-09-24 13:10 -0700 |
| Message-ID | <a126f731-fa77-4891-92b2-9348e7c64ebfo@googlegroups.com> |
| In reply to | #38849 |
Den torsdag 24 september 2020 kl. 19:02:40 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 24 september 2020 kl. 19:01:01 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 24 september 2020 kl. 18:53:46 UTC+2 skrev luserdroog:
> > > On Thursday, September 24, 2020 at 11:09:49 AM UTC-5, Jonas Thörnvall wrote:
> > > > Den torsdag 24 september 2020 kl. 18:00:06 UTC+2 skrev Jonas Thörnvall:
> > > > > Den torsdag 24 september 2020 kl. 17:32:29 UTC+2 skrev luserdroog:
> > > > > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall wrote:
> > > > > > >
> > > > > > > Could i have
> > > > > > > c = document.getElementById("myCanvas");
> > > > > > > ctm = c.getContext("2d");
> > > > > > >
> > > > > > > in a function or should they also just flap in the breeze, and must that breeze be in the same file as mouselistener?
> > > > > > >
> > > > > > > Because evidently the file with event mousecode do not reach "c" flapping in the wind.
> > > > > >
> > > > > > Sure, it can be in a function. Since you're not using `var` or `let`
> > > > > > or `const`, then c and ctm will have global scope. So as soon as the
> > > > > > function is called, these variables should be defined.
> > > > >
> > > > > Well it seem they are not, i get message not defined could it be they rest in another file? I am pretty sure i got the file order so that c and ctm load before eventhandler for mouse, i did put them in the first SRC file with the function called directly from HTML at load.
> > > > >
> > > > > But i get c is not defined, and it is c i should refer to the document canvas object, ctm is just properties/context of it?
> > > >
> > > > This is the errorcode i get.
> > > > Uncaught ReferenceError: c is not defined
> > > > at mouse.js:29
> > > >
> > > >
> > > > //These are in game engine does not matter inside early called function, or just flapping around in file.
> > > > c = document.getElementById("myCanvas");
> > > > ctm = c.getContext("2d");
> > > >
> > >
> > > I tried peeking through your github files, but I couldn't find
> > > these lines in any of the files I looked at.
> > >
> > > If it's at the top level (ie. flappin in the breeze) then it
> > > must be in a file that's loaded earlier than the one where
> > > you use it (or earlier than any calls to functions that might
> > > use it. Could it be that you're editing multiple files at once
> > > and maybe occasionally forgetting to save one before testing?
> > >
> > > BTW, 'c' probably isn't the greatest name to use for
> > > a global variable.
> >
> > Honestly i can't be bothered with syntax that do not make sense. Maybe it was a bad idea to drop the listener anyway i just set a boolean for the mouse down call.
>
> Solved....
> if(locked==false){ mousedown_logic();} else {}
Happily moved on beyond convoluted syntax that require hat on left shoe no socks, scuba gear and fan in hand. Moved on to actually get when in check correct for all cases.
Now one can fork the game freely at any move event.
https://jonasth.github.io/chess/chess.html
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2020-09-25 13:43 +0200 |
| Message-ID | <XnsAC438BA2EA80eejj99@194.109.6.166> |
| In reply to | #38849 |
<jonas.thornvall@gmail.com> wrote on 24 Sep 2020 in comp.lang.javascript:
> Solved....
> if(locked==false){ mousedown_logic();} else {}
How strange are your thought patterns,
what is the use of:
else {} ?
'locked' is not an explanatory name.
===========================
Better make it part of your mousedown execution:
let noMouseDownExecution;
noMouseDownExecution = true; // or false
function mousedown_logic() {
if (noMouseDownExecution) return;
// execution
};
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-09-25 08:44 -0700 |
| Message-ID | <67d8b5a9-294b-4c5a-ad01-930318faebdeo@googlegroups.com> |
| In reply to | #38866 |
Den fredag 25 september 2020 kl. 13:44:17 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 24 Sep 2020 in comp.lang.javascript:
>
> > Solved....
> > if(locked==false){ mousedown_logic();} else {}
>
> How strange are your thought patterns,
>
> what is the use of:
>
> else {} ?
>
> 'locked' is not an explanatory name.
>
> ===========================
>
> Better make it part of your mousedown execution:
>
> let noMouseDownExecution;
>
> noMouseDownExecution = true; // or false
>
> function mousedown_logic() {
> if (noMouseDownExecution) return;
>
> // execution
> };
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
It is just as precaution there could be a case there ;)
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-24 11:28 -0700 |
| Message-ID | <b7fcbf04-af9a-4feb-bf37-da31d8f0e436o@googlegroups.com> |
| In reply to | #38842 |
On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > Because evidently the file with event mousecode do not reach "c" > > flapping in the wind. > > Sure, it can be in a function. Since you're not using `var` or `let` > or `const`, then c and ctm will have global scope. So as soon as the > function is called, these variables should be defined. The (global) variables must be defined *before* the function gets called, not "as soon as" the function is called (which is quite misleading in this case: "as soon as" sounds more like the vars get defined by the function upon calling it). Anyway, more importantly, when answering such a question, better always point out that global variables (global state) is generally a no no, indeed it's the main source of spurious complexity (read unmanageable code) as well as, of course, of bugs all over the place. Which is exactly what is happening here, that he loses track of what is defined and where/when... Julio
[toc] | [prev] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2020-09-24 23:19 +0200 |
| Message-ID | <5f6d0d76$0$11322$e4fe514c@newszilla.xs4all.nl> |
| In reply to | #38853 |
On 9/24/20 8:28 PM, Julio Di Egidio wrote: > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: >> On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > >>> Because evidently the file with event mousecode do not reach "c" >>> flapping in the wind. >> >> Sure, it can be in a function. Since you're not using `var` or `let` >> or `const`, then c and ctm will have global scope. So as soon as the >> function is called, these variables should be defined. > > The (global) variables must be defined *before* the function gets > called, not "as soon as" the function is called (which is quite > misleading in this case: "as soon as" sounds more like the vars > get defined by the function upon calling it). > > Anyway, more importantly, when answering such a question, better > always point out that global variables (global state) is generally > a no no, indeed it's the main source of spurious complexity (read > unmanageable code) as well as, of course, of bugs all over the > place. Which is exactly what is happening here, that he loses > track of what is defined and where/when... > > Julio > Save your breath Julio. Jonas has no clue about what a global variable is. The whole concept of scope is foreign to him and he can't be bothered to learn. He just messes around with code he copy-pastes from everywhere and when thing break down he comes here to complain. He does not want you to teach him anything, he wants you to provide working code he can copy.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-24 14:51 -0700 |
| Message-ID | <d897f182-1b33-48e0-b21b-14f9ebb6431eo@googlegroups.com> |
| In reply to | #38857 |
On Thursday, 24 September 2020 23:20:10 UTC+2, Silvio wrote: > On 9/24/20 8:28 PM, Julio Di Egidio wrote: > > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > >> On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > > >>> Because evidently the file with event mousecode do not reach "c" > >>> flapping in the wind. > >> > >> Sure, it can be in a function. Since you're not using `var` or `let` > >> or `const`, then c and ctm will have global scope. So as soon as the > >> function is called, these variables should be defined. > > > > The (global) variables must be defined *before* the function gets > > called, not "as soon as" the function is called (which is quite > > misleading in this case: "as soon as" sounds more like the vars > > get defined by the function upon calling it). > > > > Anyway, more importantly, when answering such a question, better > > always point out that global variables (global state) is generally > > a no no, indeed it's the main source of spurious complexity (read > > unmanageable code) as well as, of course, of bugs all over the > > place. Which is exactly what is happening here, that he loses > > track of what is defined and where/when... > > Save your breath Julio. Jonas has no clue about what a global variable > is. The whole concept of scope is foreign to him and he can't be > bothered to learn. He just messes around with code he copy-pastes from > everywhere and when thing break down he comes here to complain. > > He does not want you to teach him anything, he wants you to provide > working code he can copy. Tell that to yourself, you and others, meanwhile notice who I am rather replying to: it's just not that insulting idiot... Julio
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2020-09-25 11:15 +0100 |
| Message-ID | <dlgrmf1h4r7jj4fjdaeo7mgr4nmtip43k6@4ax.com> |
| In reply to | #38853 |
On Thu, 24 Sep 2020 11:28:49 -0700 (PDT), Julio Di Egidio <julio@diegidio.name> wrote: <snip> >Anyway, more importantly, when answering such a question, better >always point out that global variables (global state) is generally >a no no, indeed it's the main source of spurious complexity (read >unmanageable code) as well as, of course, of bugs all over the >place. Which is exactly what is happening here, that he loses >track of what is defined and where/when... Jonas was told that in 2015 and most years since. I don't think you or anyone else is going to convince him. And this is Usenet. You don't "reply to" anyone, you say to everyone. John
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2020-09-25 13:31 +0200 |
| Message-ID | <XnsAC4389A84A50Deejj99@194.109.6.166> |
| In reply to | #38864 |
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 25 Sep 2020 in comp.lang.javascript: > And this is Usenet. You don't "reply to" anyone, you say to everyone. Indeed, but you "reply on" a posting or "reply in" a thread. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-09-25 11:01 -0700 |
| Message-ID | <7e28e509-5c4e-46a2-ab5b-d0402eabf34fo@googlegroups.com> |
| In reply to | #38853 |
On Thursday, September 24, 2020 at 1:28:59 PM UTC-5, Julio Di Egidio wrote: > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > > > Because evidently the file with event mousecode do not reach "c" > > > flapping in the wind. > > > > Sure, it can be in a function. Since you're not using `var` or `let` > > or `const`, then c and ctm will have global scope. So as soon as the > > function is called, these variables should be defined. > > The (global) variables must be defined *before* the function gets > called, not "as soon as" the function is called (which is quite > misleading in this case: "as soon as" sounds more like the vars > get defined by the function upon calling it). > Perhaps I misunderstood the question. I was referring to a function enclosing the shown code which defined the variables. As soon as the function (which defines the variables) is called -- or more properly, as soon as the call returns -- then the variables are defined. This reduces the haystack of determining when such things happen. Of course, all of this must happen before calling any function which tries to use those variables. > Anyway, more importantly, when answering such a question, better > always point out that global variables (global state) is generally > a no no, indeed it's the main source of spurious complexity (read > unmanageable code) as well as, of course, of bugs all over the > place. Which is exactly what is happening here, that he loses > track of what is defined and where/when... Baby steps and kid gloves. I'm trying to offer help that OP might actually find helpful. But I do share your definition of the problem.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-09-25 11:06 -0700 |
| Message-ID | <65d5b937-be39-4053-a77d-950bbf22ed5do@googlegroups.com> |
| In reply to | #38868 |
Den fredag 25 september 2020 kl. 20:01:38 UTC+2 skrev luserdroog: > On Thursday, September 24, 2020 at 1:28:59 PM UTC-5, Julio Di Egidio wrote: > > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > > > > > Because evidently the file with event mousecode do not reach "c" > > > > flapping in the wind. > > > > > > Sure, it can be in a function. Since you're not using `var` or `let` > > > or `const`, then c and ctm will have global scope. So as soon as the > > > function is called, these variables should be defined. > > > > The (global) variables must be defined *before* the function gets > > called, not "as soon as" the function is called (which is quite > > misleading in this case: "as soon as" sounds more like the vars > > get defined by the function upon calling it). > > > > Perhaps I misunderstood the question. I was referring to a > function enclosing the shown code which defined the variables. > As soon as the function (which defines the variables) is called > -- or more properly, as soon as the call returns -- then the > variables are defined. This reduces the haystack of determining > when such things happen. > > Of course, all of this must happen before calling any function > which tries to use those variables. > > > Anyway, more importantly, when answering such a question, better > > always point out that global variables (global state) is generally > > a no no, indeed it's the main source of spurious complexity (read > > unmanageable code) as well as, of course, of bugs all over the > > place. Which is exactly what is happening here, that he loses > > track of what is defined and where/when... > > Baby steps and kid gloves. I'm trying to offer help that OP might > actually find helpful. But I do share your definition of the > problem. Global variables no problem with 4 GB of memory, and you can always fix them. It is just convenience skipping the luggage by teleporting.
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-09-25 11:15 -0700 |
| Message-ID | <d0233fe2-fce0-44ec-b8f3-f73ae37bddb8o@googlegroups.com> |
| In reply to | #38869 |
On Friday, September 25, 2020 at 1:06:56 PM UTC-5, Jonas Thörnvall wrote: > Den fredag 25 september 2020 kl. 20:01:38 UTC+2 skrev luserdroog: > > On Thursday, September 24, 2020 at 1:28:59 PM UTC-5, Julio Di Egidio wrote: > > > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > > > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > > > > > > > Because evidently the file with event mousecode do not reach "c" > > > > > flapping in the wind. > > > > > > > > Sure, it can be in a function. Since you're not using `var` or `let` > > > > or `const`, then c and ctm will have global scope. So as soon as the > > > > function is called, these variables should be defined. > > > > > > The (global) variables must be defined *before* the function gets > > > called, not "as soon as" the function is called (which is quite > > > misleading in this case: "as soon as" sounds more like the vars > > > get defined by the function upon calling it). > > > > > > > Perhaps I misunderstood the question. I was referring to a > > function enclosing the shown code which defined the variables. > > As soon as the function (which defines the variables) is called > > -- or more properly, as soon as the call returns -- then the > > variables are defined. This reduces the haystack of determining > > when such things happen. > > > > Of course, all of this must happen before calling any function > > which tries to use those variables. > > > > > Anyway, more importantly, when answering such a question, better > > > always point out that global variables (global state) is generally > > > a no no, indeed it's the main source of spurious complexity (read > > > unmanageable code) as well as, of course, of bugs all over the > > > place. Which is exactly what is happening here, that he loses > > > track of what is defined and where/when... > > > > Baby steps and kid gloves. I'm trying to offer help that OP might > > actually find helpful. But I do share your definition of the > > problem. > > Global variables no problem with 4 GB of memory, and you can always fix them. > > It is just convenience skipping the luggage by teleporting. It's not a problem of the computer's memory. It a problem of the human memory. One trick that can help and it not too difficult to do is to wrap all the globals in a single object called "global". This makes it much easier to see when a global variable is being accessed, "global.variable" and sets you up in case you want to start passing the object around instead of accessing it through the global object.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-26 04:41 -0700 |
| Message-ID | <99b95256-da9c-4efa-8180-517973ae2794o@googlegroups.com> |
| In reply to | #38870 |
On Friday, 25 September 2020 20:15:52 UTC+2, luserdroog wrote: > On Friday, September 25, 2020 at 1:06:56 PM UTC-5, Jonas Thörnvall wrote: > Global variables no problem with 4 GB of memory, and you can always fix them. > > > > It is just convenience skipping the luggage by teleporting. > > It's not a problem of the computer's memory. It a problem of > the human memory. One trick that can help and it not too > difficult to do is to wrap all the globals in a single object > called "global". This makes it much easier to see when a > global variable is being accessed, "global.variable" and > sets you up in case you want to start passing the object around > instead of accessing it through the global object. For your info you are just talking incompetent and utter bullshit. The problem is neither memory nor "seeing it", the problem is, as I have said upthread, the spaghetti code, i.e. convoluted and unmanageable mess that that leads to in anhy case, i.e. even if you use "global.whatever" or any some psuedo-clever such. You too, get your head out of your ass for a change... Julio
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-26 04:46 -0700 |
| Message-ID | <6679ac03-0e44-4e30-8cf6-bffc2d31eb72o@googlegroups.com> |
| In reply to | #38872 |
On Saturday, 26 September 2020 13:42:03 UTC+2, Julio Di Egidio wrote: > On Friday, 25 September 2020 20:15:52 UTC+2, luserdroog wrote: > You too, get your head out of your ass for a change... By which I just mean, to be clear, that errare humanum est, perseverare diabolicum... Enough said. Julio
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-26 04:33 -0700 |
| Message-ID | <3bd6d22d-9756-44fe-8f72-cdab1514b649o@googlegroups.com> |
| In reply to | #38868 |
On Friday, 25 September 2020 20:01:38 UTC+2, luserdroog wrote: > On Thursday, September 24, 2020 at 1:28:59 PM UTC-5, Julio Di Egidio wrote: > > On Thursday, 24 September 2020 17:32:29 UTC+2, luserdroog wrote: > > > On Thursday, September 24, 2020 at 4:52:24 AM UTC-5, Jonas Thörnvall > > > > > > Because evidently the file with event mousecode do not reach "c" > > > > flapping in the wind. > > > > > > Sure, it can be in a function. Since you're not using `var` or `let` > > > or `const`, then c and ctm will have global scope. So as soon as the > > > function is called, these variables should be defined. > > > > The (global) variables must be defined *before* the function gets > > called, not "as soon as" the function is called (which is quite > > misleading in this case: "as soon as" sounds more like the vars > > get defined by the function upon calling it). > > Perhaps I misunderstood the question. No, you didn't, it's me not bothering to follow along the lines of patent absurdities. > I was referring to a > function enclosing the shown code which defined the variables. > As soon as the function (which defines the variables) is called > -- or more properly, as soon as the call returns -- then the > variables are defined. This reduces the haystack of determining > when such things happen. Which is even worse than just using global variables. > Of course, all of this must happen before calling any function > which tries to use those variables. > > > Anyway, more importantly, when answering such a question, better > > always point out that global variables (global state) is generally > > a no no, indeed it's the main source of spurious complexity (read > > unmanageable code) as well as, of course, of bugs all over the > > place. Which is exactly what is happening here, that he loses > > track of what is defined and where/when... > > Baby steps and kid gloves. I'm trying to offer help that OP might > actually find helpful. But I do share your definition of the > problem. But you miss my point: your advice to the letter of the question asked is exactly of the same ugly quality as that question, while a decent answer here was *just don't do that and pass a fucking parameter*... Julio
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-09-26 09:32 -0700 |
| Message-ID | <0eaf565b-2a32-4867-b2f4-62ef11e34b7bo@googlegroups.com> |
| In reply to | #38871 |
On Saturday, September 26, 2020 at 6:33:17 AM UTC-5, Julio Di Egidio wrote: > On Friday, 25 September 2020 20:01:38 UTC+2, luserdroog wrote: > > Baby steps and kid gloves. I'm trying to offer help that OP might > > actually find helpful. But I do share your definition of the > > problem. > > But you miss my point: your advice to the letter of the question > asked is exactly of the same ugly quality as that question, while > a decent answer here was *just don't do that and pass a fucking > parameter*... How are the new meds working out?
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-09-26 11:05 -0700 |
| Message-ID | <6d19e574-efa7-497c-b492-4703513c8136o@googlegroups.com> |
| In reply to | #38874 |
On Saturday, 26 September 2020 18:32:49 UTC+2, luserdroog wrote: > On Saturday, September 26, 2020 at 6:33:17 AM UTC-5, Julio Di Egidio wrote: > > On Friday, 25 September 2020 20:01:38 UTC+2, luserdroog wrote: > > > > Baby steps and kid gloves. I'm trying to offer help that OP might > > > actually find helpful. But I do share your definition of the > > > problem. > > > > But you miss my point: your advice to the letter of the question > > asked is exactly of the same ugly quality as that question, while > > a decent answer here was *just don't do that and pass a fucking > > parameter*... > > How are the new meds working out? LOL, and that was the most sober statement: you confirm yourself yet another total moron. Congrats. *Plonk* Julio
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.javascript
csiph-web