Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36868 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2019-06-12 14:40 -0700 |
| Last post | 2019-06-13 04:20 -0700 |
| Articles | 20 on this page of 30 — 5 participants |
Back to article view | Back to comp.lang.javascript
Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 14:40 -0700
Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-12 23:54 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 23:41 -0700
Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:27 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 23:56 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 00:49 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 00:57 -0700
Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:31 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:19 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:21 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:26 -0700
Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 13:43 +0200
Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:29 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:13 -0700
Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-13 12:24 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:36 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:48 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:56 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:01 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:03 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:10 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:14 -0700
Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 13:45 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 03:36 -0700
Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-15 13:49 +0200
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 06:31 -0700
Re: Rudimentary programming methodology dr.j.r.stockton@gmail.com - 2019-06-15 07:40 -0700
Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 08:25 -0700
Re: Rudimentary programming methodology JJ <jj4public@vfemail.net> - 2019-06-13 15:13 +0700
Re: Rudimentary programming methodology dr.j.r.stockton@gmail.com - 2019-06-13 04:20 -0700
Page 1 of 2 [1] 2 Next page →
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-12 14:40 -0700 |
| Subject | Rudimentary programming methodology |
| Message-ID | <9beb723d-79b6-4894-bf22-6906fb06dec1@googlegroups.com> |
I have a problem that i should know howto solve it is probably very basic.
Normally when you have choices, the most common way is to solve it with if, else if.
But sometimes your choices is fundamental to a process, so they are the input parmeters for something.
In my case i have a metronome, but depending on the "synth/hardware" you want to use you simply select it from an option list.
And now i could do
if (met=="external") {something sent to port)
else if (met=="othersynth") {something else sent to port}
else if (met=="anothersynth") {something else sent to port}
If these are timed events it is not that effective to do this x times a second.
So you just want check and set the case once? and then be used everytime during the interval?
I guess that means to breakout the if cases into functions?
But you just want the actual function call to differ, but not be checked every time you send something to the metronome.
Basicly about setting what function to be called once, like flipping a switch and then it always take that "path".
I have a slight memory it could be case programming using switches, but i don't quite see hot it applies dealing with timed events during an interval?
Basicly i want to replace if else if before every metronome event.
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2019-06-12 23:54 +0200 |
| Message-ID | <XnsAA6CF33282DACeejj99@194.109.6.166> |
| In reply to | #36868 |
=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 12
Jun 2019 in comp.lang.javascript:
> I have a problem that i should know howto solve it is probably very
> basic.
>
> Normally when you have choices, the most common way is to solve it with
> if, else if.
>
> But sometimes your choices is fundamental to a process, so they are the
> input parmeters for something.
>
> In my case i have a metronome, but depending on the "synth/hardware" you
> want to use you simply select it from an option list.
>
> And now i could do
>
> if (met=="external") {something sent to port)
> else if (met=="othersynth") {something else sent to port}
> else if (met=="anothersynth") {something else sent to port}
>
>
> If these are timed events it is not that effective to do this x times a
> second.
>
> So you just want check and set the case once? and then be used everytime
> during the interval?
>
> I guess that means to breakout the if cases into functions?
> But you just want the actual function call to differ, but not be checked
> every time you send something to the metronome.
>
> Basicly about setting what function to be called once, like flipping a
> switch and then it always take that "path".
>
> I have a slight memory it could be case programming using switches, but
> i don't quite see hot it applies dealing with timed events during an
> interval?
>
> Basicly i want to replace if else if before every metronome event.
Basically you are not making sense,
even for one professing a slight memory.
Your timing requirements ar by large not short enough
to require machine language decision speeds.
Scripting language witches internally are just if-else-then constructs,
and are perfect to implement logic showing a clearer human visible script,
not for much faster 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 | 2019-06-12 23:41 -0700 |
| Message-ID | <d7674b3f-1357-4f6c-a389-8d9f2d6645e1@googlegroups.com> |
| In reply to | #36869 |
Den torsdag 13 juni 2019 kl. 00:45:19 UTC+2 skrev Evertjan.:
> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 12
> Jun 2019 in comp.lang.javascript:
>
> > I have a problem that i should know howto solve it is probably very
> > basic.
> >
> > Normally when you have choices, the most common way is to solve it with
> > if, else if.
> >
> > But sometimes your choices is fundamental to a process, so they are the
> > input parmeters for something.
> >
> > In my case i have a metronome, but depending on the "synth/hardware" you
> > want to use you simply select it from an option list.
> >
> > And now i could do
> >
> > if (met=="external") {something sent to port)
> > else if (met=="othersynth") {something else sent to port}
> > else if (met=="anothersynth") {something else sent to port}
> >
> >
> > If these are timed events it is not that effective to do this x times a
> > second.
> >
> > So you just want check and set the case once? and then be used everytime
> > during the interval?
> >
> > I guess that means to breakout the if cases into functions?
> > But you just want the actual function call to differ, but not be checked
> > every time you send something to the metronome.
> >
> > Basicly about setting what function to be called once, like flipping a
> > switch and then it always take that "path".
> >
> > I have a slight memory it could be case programming using switches, but
> > i don't quite see hot it applies dealing with timed events during an
> > interval?
> >
> > Basicly i want to replace if else if before every metronome event.
>
> Basically you are not making sense,
> even for one professing a slight memory.
>
> Your timing requirements ar by large not short enough
> to require machine language decision speeds.
>
> Scripting language witches internally are just if-else-then constructs,
> and are perfect to implement logic showing a clearer human visible script,
> not for much faster execution.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
So you say an if else every x milliseconds is ok?
Let say it would 10 choices would it still be ok?
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2019-06-13 11:27 +0200 |
| Message-ID | <gmej88Ffp58U1@mid.individual.net> |
| In reply to | #36872 |
On 13.06.19 08:41, Jonas Thörnvall wrote: [...] > So you say an if else every x milliseconds is ok? > Let say it would 10 choices would it still be ok? Yes. JavaScript is fast enough nowadays to run even complete games in 3D in the browser: <http://www.quakejs.com/> -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-12 23:56 -0700 |
| Message-ID | <69a21152-fca0-4037-a818-7e61ed22fe5f@googlegroups.com> |
| In reply to | #36869 |
Den torsdag 13 juni 2019 kl. 00:45:19 UTC+2 skrev Evertjan.:
> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 12
> Jun 2019 in comp.lang.javascript:
>
> > I have a problem that i should know howto solve it is probably very
> > basic.
> >
> > Normally when you have choices, the most common way is to solve it with
> > if, else if.
> >
> > But sometimes your choices is fundamental to a process, so they are the
> > input parmeters for something.
> >
> > In my case i have a metronome, but depending on the "synth/hardware" you
> > want to use you simply select it from an option list.
> >
> > And now i could do
> >
> > if (met=="external") {something sent to port)
> > else if (met=="othersynth") {something else sent to port}
> > else if (met=="anothersynth") {something else sent to port}
> >
> >
> > If these are timed events it is not that effective to do this x times a
> > second.
> >
> > So you just want check and set the case once? and then be used everytime
> > during the interval?
> >
> > I guess that means to breakout the if cases into functions?
> > But you just want the actual function call to differ, but not be checked
> > every time you send something to the metronome.
> >
> > Basicly about setting what function to be called once, like flipping a
> > switch and then it always take that "path".
> >
> > I have a slight memory it could be case programming using switches, but
> > i don't quite see hot it applies dealing with timed events during an
> > interval?
> >
> > Basicly i want to replace if else if before every metronome event.
>
> Basically you are not making sense,
> even for one professing a slight memory.
>
> Your timing requirements ar by large not short enough
> to require machine language decision speeds.
>
> Scripting language witches internally are just if-else-then constructs,
> and are perfect to implement logic showing a clearer human visible script,
> not for much faster execution.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Even if it is not necessary in my case, is there a construct to handle this type of problems in Javascript? It must be something with realtime switches of sort.
It seem analogue to setting a switch to chose a leg/route "before" the actual timed events take place?
Is there a typecase for howto solve these types of problems?
Because i am a bit stumped for how i should tackle this type of problem?
They seem to create full legs with much more code then the actual choice of metronome? I could solve this type of problem with alot of code duplicated, but there must be some construct to just handle the explicit choice of metronome?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 00:49 -0700 |
| Message-ID | <1278c859-eec5-4787-966a-38ac2b9af03b@googlegroups.com> |
| In reply to | #36873 |
Den torsdag 13 juni 2019 kl. 08:57:06 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 00:45:19 UTC+2 skrev Evertjan.:
> > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 12
> > Jun 2019 in comp.lang.javascript:
> >
> > > I have a problem that i should know howto solve it is probably very
> > > basic.
> > >
> > > Normally when you have choices, the most common way is to solve it with
> > > if, else if.
> > >
> > > But sometimes your choices is fundamental to a process, so they are the
> > > input parmeters for something.
> > >
> > > In my case i have a metronome, but depending on the "synth/hardware" you
> > > want to use you simply select it from an option list.
> > >
> > > And now i could do
> > >
> > > if (met=="external") {something sent to port)
> > > else if (met=="othersynth") {something else sent to port}
> > > else if (met=="anothersynth") {something else sent to port}
> > >
> > >
> > > If these are timed events it is not that effective to do this x times a
> > > second.
> > >
> > > So you just want check and set the case once? and then be used everytime
> > > during the interval?
> > >
> > > I guess that means to breakout the if cases into functions?
> > > But you just want the actual function call to differ, but not be checked
> > > every time you send something to the metronome.
> > >
> > > Basicly about setting what function to be called once, like flipping a
> > > switch and then it always take that "path".
> > >
> > > I have a slight memory it could be case programming using switches, but
> > > i don't quite see hot it applies dealing with timed events during an
> > > interval?
> > >
> > > Basicly i want to replace if else if before every metronome event.
> >
> > Basically you are not making sense,
> > even for one professing a slight memory.
> >
> > Your timing requirements ar by large not short enough
> > to require machine language decision speeds.
> >
> > Scripting language witches internally are just if-else-then constructs,
> > and are perfect to implement logic showing a clearer human visible script,
> > not for much faster execution.
> >
> > --
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
>
> Even if it is not necessary in my case, is there a construct to handle this type of problems in Javascript? It must be something with realtime switches of sort.
>
> It seem analogue to setting a switch to chose a leg/route "before" the actual timed events take place?
>
> Is there a typecase for howto solve these types of problems?
> Because i am a bit stumped for how i should tackle this type of problem?
> They seem to create full legs with much more code then the actual choice of metronome? I could solve this type of problem with alot of code duplicated, but there must be some construct to just handle the explicit choice of metronome?
I guess this is maybe also about programming language methodology?
What would been awesome in languages would be...."i just dealt with highlevel Turbo Pascal, a little C , Java and javascript
A construct? like this.
Case A {do this}
Case B {do that}
Case C {do something else}
If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
start process
do Case;
end process
Maybe there already is and i am just lost on howto?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 00:57 -0700 |
| Message-ID | <02fafd13-fb2d-4ccb-bff3-bc6a70fe20dd@googlegroups.com> |
| In reply to | #36875 |
Den torsdag 13 juni 2019 kl. 09:49:39 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 08:57:06 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 13 juni 2019 kl. 00:45:19 UTC+2 skrev Evertjan.:
> > > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 12
> > > Jun 2019 in comp.lang.javascript:
> > >
> > > > I have a problem that i should know howto solve it is probably very
> > > > basic.
> > > >
> > > > Normally when you have choices, the most common way is to solve it with
> > > > if, else if.
> > > >
> > > > But sometimes your choices is fundamental to a process, so they are the
> > > > input parmeters for something.
> > > >
> > > > In my case i have a metronome, but depending on the "synth/hardware" you
> > > > want to use you simply select it from an option list.
> > > >
> > > > And now i could do
> > > >
> > > > if (met=="external") {something sent to port)
> > > > else if (met=="othersynth") {something else sent to port}
> > > > else if (met=="anothersynth") {something else sent to port}
> > > >
> > > >
> > > > If these are timed events it is not that effective to do this x times a
> > > > second.
> > > >
> > > > So you just want check and set the case once? and then be used everytime
> > > > during the interval?
> > > >
> > > > I guess that means to breakout the if cases into functions?
> > > > But you just want the actual function call to differ, but not be checked
> > > > every time you send something to the metronome.
> > > >
> > > > Basicly about setting what function to be called once, like flipping a
> > > > switch and then it always take that "path".
> > > >
> > > > I have a slight memory it could be case programming using switches, but
> > > > i don't quite see hot it applies dealing with timed events during an
> > > > interval?
> > > >
> > > > Basicly i want to replace if else if before every metronome event.
> > >
> > > Basically you are not making sense,
> > > even for one professing a slight memory.
> > >
> > > Your timing requirements ar by large not short enough
> > > to require machine language decision speeds.
> > >
> > > Scripting language witches internally are just if-else-then constructs,
> > > and are perfect to implement logic showing a clearer human visible script,
> > > not for much faster execution.
> > >
> > > --
> > > Evertjan.
> > > The Netherlands.
> > > (Please change the x'es to dots in my emailaddress)
> >
> > Even if it is not necessary in my case, is there a construct to handle this type of problems in Javascript? It must be something with realtime switches of sort.
> >
> > It seem analogue to setting a switch to chose a leg/route "before" the actual timed events take place?
> >
> > Is there a typecase for howto solve these types of problems?
> > Because i am a bit stumped for how i should tackle this type of problem?
> > They seem to create full legs with much more code then the actual choice of metronome? I could solve this type of problem with alot of code duplicated, but there must be some construct to just handle the explicit choice of metronome?
>
> I guess this is maybe also about programming language methodology?
>
> What would been awesome in languages would be...."i just dealt with highlevel Turbo Pascal, a little C , Java and javascript
>
> A construct? like this.
>
> Case A {do this}
> Case B {do that}
> Case C {do something else}
>
> If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
>
> start process
> do Case;
> end process
>
> Maybe there already is and i am just lost on howto?
I guess that Case in my example is a variable / construct holding an adress to some code to be run?
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2019-06-13 11:31 +0200 |
| Message-ID | <gmejfrFfp58U3@mid.individual.net> |
| In reply to | #36876 |
On 13.06.19 09:57, Jonas Thörnvall wrote: [Many many other posts] > I guess that Case in my example is a variable / construct holding an > adress to some code to be run? PLEASE! Think first about your problem before you ask. It makes no sense to send seven(!) posts with your own thoughts. This indicates that you may not even know what your real problem is what you want to solve. -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:19 -0700 |
| Message-ID | <3e32b040-4f3e-48bd-874b-de0cc0e8e4e3@googlegroups.com> |
| In reply to | #36881 |
Den torsdag 13 juni 2019 kl. 11:31:44 UTC+2 skrev Arno Welzel: > On 13.06.19 09:57, Jonas Thörnvall wrote: > > [Many many other posts] > > I guess that Case in my example is a variable / construct holding an > > adress to some code to be run? > > > PLEASE! Think first about your problem before you ask. It makes no sense > to send seven(!) posts with your own thoughts. This indicates that you > may not even know what your real problem is what you want to solve. > > > -- > Arno Welzel > https://arnowelzel.de Evertjan Quote: Scripting language witches internally are just if-else-then constructs, and are perfect to implement logic showing a clearer human visible script, not for much faster execution.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:21 -0700 |
| Message-ID | <27d0148f-d730-4ea9-b6a8-8f276469ec68@googlegroups.com> |
| In reply to | #36881 |
Den torsdag 13 juni 2019 kl. 11:31:44 UTC+2 skrev Arno Welzel: > On 13.06.19 09:57, Jonas Thörnvall wrote: > > [Many many other posts] > > I guess that Case in my example is a variable / construct holding an > > adress to some code to be run? > > > PLEASE! Think first about your problem before you ask. It makes no sense > to send seven(!) posts with your own thoughts. This indicates that you > may not even know what your real problem is what you want to solve. > > > -- > Arno Welzel > https://arnowelzel.de So was Evertjan wrong?, joking? or is my question still valid and unanswered?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:26 -0700 |
| Message-ID | <5c54cb5c-aba5-408d-a349-33b5445c72aa@googlegroups.com> |
| In reply to | #36881 |
Den torsdag 13 juni 2019 kl. 11:31:44 UTC+2 skrev Arno Welzel: > On 13.06.19 09:57, Jonas Thörnvall wrote: > > [Many many other posts] > > I guess that Case in my example is a variable / construct holding an > > adress to some code to be run? > > > PLEASE! Think first about your problem before you ask. It makes no sense > to send seven(!) posts with your own thoughts. This indicates that you > may not even know what your real problem is what you want to solve. > > > -- > Arno Welzel > https://arnowelzel.de I think i found the difference between if else if and switch. It seem that if else if do not break when found, so if there is many else if still steps thru? While the switch "do indeed check sequential the cases until found and break" ***well if i understand correct*** But i think Evertjan is correct switch do an evaluation? Quote google "As it turns out, the switch statement is faster in most cases when compared to if-else , but significantly faster only when the number of conditions is large. The primary difference in performance between the two is that the incremental cost of an additional condition is larger for if-else than" it is for switch .
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2019-06-13 13:43 +0200 |
| Message-ID | <gmer6qFheehU1@mid.individual.net> |
| In reply to | #36888 |
On 13.06.19 12:26, Jonas Thörnvall wrote: > Den torsdag 13 juni 2019 kl. 11:31:44 UTC+2 skrev Arno Welzel: >> On 13.06.19 09:57, Jonas Thörnvall wrote: >> >> [Many many other posts] >>> I guess that Case in my example is a variable / construct >>> holding an adress to some code to be run? >> >> >> PLEASE! Think first about your problem before you ask. It makes no >> sense to send seven(!) posts with your own thoughts. This indicates >> that you may not even know what your real problem is what you want >> to solve. >> >> >> -- Arno Welzel https://arnowelzel.de > > I think i found the difference between if else if and switch. It seem > that if else if do not break when found, so if there is many else if > still steps thru? [...] Again - THREE posts. Why? I don't answer any of them any longer, since I have to expect, that another 5 to 10 posts follow just right to the one which was answered... -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2019-06-13 11:29 +0200 |
| Message-ID | <gmejb9Ffp58U2@mid.individual.net> |
| In reply to | #36875 |
On 13.06.19 09:49, Jonas Thörnvall wrote:
> A construct? like this.
>
> Case A {do this}
> Case B {do that}
> Case C {do something else}
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch>
--
Arno Welzel
https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:13 -0700 |
| Message-ID | <383de7d3-c422-4039-91dd-576f5a815d0a@googlegroups.com> |
| In reply to | #36880 |
Den torsdag 13 juni 2019 kl. 11:29:18 UTC+2 skrev Arno Welzel:
> On 13.06.19 09:49, Jonas Thörnvall wrote:
>
> > A construct? like this.
> >
> > Case A {do this}
> > Case B {do that}
> > Case C {do something else}
>
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch>
>
>
>
> --
> Arno Welzel
> https://arnowelzel.de
Well Arno Evertjan claimed that javscript switch is just a fancy layout and doing if else if in background. So it is just a reading aid for code.
But maybe he was just trying to pull a joke upon me.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2019-06-13 12:24 +0200 |
| Message-ID | <XnsAA6D7E4028C9Beejj99@194.109.6.166> |
| In reply to | #36883 |
=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13 Jun 2019 in comp.lang.javascript: > Well Arno Evertjan claimed that javscript switch is just a fancy layout > and doing if else if in background. So it is just a reading aid for > code. No, you should not try to read between the lines. A switch DOES the same in the background as a if-then-else construct does, but IS NOT the same. You can easily measure any timing improvement by setting up a test script. > But maybe he was just trying to pull a joke upon me. This is the first sensible idea you have, you should always be prepared for that. After all, forgetting the sex thing, there is only one thing more enjoyable than discussing by arguments, and that is exchanging jokes. PS: the discussion being more educational. -- 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 | 2019-06-13 03:36 -0700 |
| Message-ID | <0d0ea75c-5b26-4f88-8094-5edeaca4199d@googlegroups.com> |
| In reply to | #36887 |
Den torsdag 13 juni 2019 kl. 12:24:42 UTC+2 skrev Evertjan.:
> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13
> Jun 2019 in comp.lang.javascript:
>
> > Well Arno Evertjan claimed that javscript switch is just a fancy layout
> > and doing if else if in background. So it is just a reading aid for
> > code.
>
> No, you should not try to read between the lines.
>
> A switch DOES the same in the background as a if-then-else construct does,
> but IS NOT the same.
>
> You can easily measure any timing improvement by setting up a test script.
>
> > But maybe he was just trying to pull a joke upon me.
>
> This is the first sensible idea you have,
> you should always be prepared for that.
>
> After all, forgetting the sex thing, there is only one thing more enjoyable
> than discussing by arguments, and that is exchanging jokes.
>
> PS: the discussion being more educational.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Well you make me confused Evertjan is there a sequential case evaluation until break, or is case basicly a function call to the appropriate case?
If it is not, why does not javascript have a construct more like this pseudocode where Case basicly a variable assigned to hold a function call?
Case A {do this}
Case B {do that}
Case C {do something else}
If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
start process
do Case;
end process
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:48 -0700 |
| Message-ID | <7e2e0f80-cb71-4485-a2ac-c07754af34a5@googlegroups.com> |
| In reply to | #36890 |
Den torsdag 13 juni 2019 kl. 12:36:51 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 12:24:42 UTC+2 skrev Evertjan.:
> > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13
> > Jun 2019 in comp.lang.javascript:
> >
> > > Well Arno Evertjan claimed that javscript switch is just a fancy layout
> > > and doing if else if in background. So it is just a reading aid for
> > > code.
> >
> > No, you should not try to read between the lines.
> >
> > A switch DOES the same in the background as a if-then-else construct does,
> > but IS NOT the same.
> >
> > You can easily measure any timing improvement by setting up a test script.
> >
> > > But maybe he was just trying to pull a joke upon me.
> >
> > This is the first sensible idea you have,
> > you should always be prepared for that.
> >
> > After all, forgetting the sex thing, there is only one thing more enjoyable
> > than discussing by arguments, and that is exchanging jokes.
> >
> > PS: the discussion being more educational.
> >
> > --
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
>
> Well you make me confused Evertjan is there a sequential case evaluation until break, or is case basicly a function call to the appropriate case?
>
> If it is not, why does not javascript have a construct more like this pseudocode where Case basicly a variable assigned to hold a function call?
>
> Case A {do this}
> Case B {do that}
> Case C {do something else}
>
> If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
>
> start process
> do Case;
> end process
This syntax would probably be more suitable for javascript.
Case(A) {do this}
Case(B) {do that}
Case(C) {do something else}
If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
setTimeout(function(){Case(x);}, 300);
Well i know that x is normally a function parameter, and there is no syntax appropriate but since Case probably a reserved word i see no problem with it.
I think it is rather beautiful in its simplicity?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 03:56 -0700 |
| Message-ID | <9fd5e226-25d5-49e0-b71d-7fc0890707c8@googlegroups.com> |
| In reply to | #36891 |
Den torsdag 13 juni 2019 kl. 12:48:45 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 12:36:51 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 13 juni 2019 kl. 12:24:42 UTC+2 skrev Evertjan.:
> > > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13
> > > Jun 2019 in comp.lang.javascript:
> > >
> > > > Well Arno Evertjan claimed that javscript switch is just a fancy layout
> > > > and doing if else if in background. So it is just a reading aid for
> > > > code.
> > >
> > > No, you should not try to read between the lines.
> > >
> > > A switch DOES the same in the background as a if-then-else construct does,
> > > but IS NOT the same.
> > >
> > > You can easily measure any timing improvement by setting up a test script.
> > >
> > > > But maybe he was just trying to pull a joke upon me.
> > >
> > > This is the first sensible idea you have,
> > > you should always be prepared for that.
> > >
> > > After all, forgetting the sex thing, there is only one thing more enjoyable
> > > than discussing by arguments, and that is exchanging jokes.
> > >
> > > PS: the discussion being more educational.
> > >
> > > --
> > > Evertjan.
> > > The Netherlands.
> > > (Please change the x'es to dots in my emailaddress)
> >
> > Well you make me confused Evertjan is there a sequential case evaluation until break, or is case basicly a function call to the appropriate case?
> >
> > If it is not, why does not javascript have a construct more like this pseudocode where Case basicly a variable assigned to hold a function call?
> >
> > Case A {do this}
> > Case B {do that}
> > Case C {do something else}
> >
> > If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
> >
> > start process
> > do Case;
> > end process
>
> This syntax would probably be more suitable for javascript.
>
> Case(A) {do this}
> Case(B) {do that}
> Case(C) {do something else}
>
> If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
>
>
> setTimeout(function(){Case(x);}, 300);
>
> Well i know that x is normally a function parameter, and there is no syntax appropriate but since Case probably a reserved word i see no problem with it.
>
> I think it is rather beautiful in its simplicity?
So the string value of x decide case it will chose?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 04:01 -0700 |
| Message-ID | <7c59fdb7-201f-4e71-be56-e8d016c84873@googlegroups.com> |
| In reply to | #36891 |
Den torsdag 13 juni 2019 kl. 12:48:45 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 12:36:51 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 13 juni 2019 kl. 12:24:42 UTC+2 skrev Evertjan.:
> > > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13
> > > Jun 2019 in comp.lang.javascript:
> > >
> > > > Well Arno Evertjan claimed that javscript switch is just a fancy layout
> > > > and doing if else if in background. So it is just a reading aid for
> > > > code.
> > >
> > > No, you should not try to read between the lines.
> > >
> > > A switch DOES the same in the background as a if-then-else construct does,
> > > but IS NOT the same.
> > >
> > > You can easily measure any timing improvement by setting up a test script.
> > >
> > > > But maybe he was just trying to pull a joke upon me.
> > >
> > > This is the first sensible idea you have,
> > > you should always be prepared for that.
> > >
> > > After all, forgetting the sex thing, there is only one thing more enjoyable
> > > than discussing by arguments, and that is exchanging jokes.
> > >
> > > PS: the discussion being more educational.
> > >
> > > --
> > > Evertjan.
> > > The Netherlands.
> > > (Please change the x'es to dots in my emailaddress)
> >
> > Well you make me confused Evertjan is there a sequential case evaluation until break, or is case basicly a function call to the appropriate case?
> >
> > If it is not, why does not javascript have a construct more like this pseudocode where Case basicly a variable assigned to hold a function call?
> >
> > Case A {do this}
> > Case B {do that}
> > Case C {do something else}
> >
> > If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
> >
> > start process
> > do Case;
> > end process
>
> This syntax would probably be more suitable for javascript.
>
> Case(A) {do this}
> Case(B) {do that}
> Case(C) {do something else}
>
> If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
>
>
> setTimeout(function(){Case(x);}, 300);
>
> Well i know that x is normally a function parameter, and there is no syntax appropriate but since Case probably a reserved word i see no problem with it.
>
> I think it is rather beautiful in its simplicity?
Well maybe you lke this syntax better.
Case:A {do this}
Case:B {do that}
Case:C {do something else}
If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
setTimeout(function(){Case:(x);}, 300)
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-06-13 04:03 -0700 |
| Message-ID | <e01898d8-3980-4f35-929a-31483e13c0fb@googlegroups.com> |
| In reply to | #36894 |
Den torsdag 13 juni 2019 kl. 13:01:26 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 13 juni 2019 kl. 12:48:45 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 13 juni 2019 kl. 12:36:51 UTC+2 skrev Jonas Thörnvall:
> > > Den torsdag 13 juni 2019 kl. 12:24:42 UTC+2 skrev Evertjan.:
> > > > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 13
> > > > Jun 2019 in comp.lang.javascript:
> > > >
> > > > > Well Arno Evertjan claimed that javscript switch is just a fancy layout
> > > > > and doing if else if in background. So it is just a reading aid for
> > > > > code.
> > > >
> > > > No, you should not try to read between the lines.
> > > >
> > > > A switch DOES the same in the background as a if-then-else construct does,
> > > > but IS NOT the same.
> > > >
> > > > You can easily measure any timing improvement by setting up a test script.
> > > >
> > > > > But maybe he was just trying to pull a joke upon me.
> > > >
> > > > This is the first sensible idea you have,
> > > > you should always be prepared for that.
> > > >
> > > > After all, forgetting the sex thing, there is only one thing more enjoyable
> > > > than discussing by arguments, and that is exchanging jokes.
> > > >
> > > > PS: the discussion being more educational.
> > > >
> > > > --
> > > > Evertjan.
> > > > The Netherlands.
> > > > (Please change the x'es to dots in my emailaddress)
> > >
> > > Well you make me confused Evertjan is there a sequential case evaluation until break, or is case basicly a function call to the appropriate case?
> > >
> > > If it is not, why does not javascript have a construct more like this pseudocode where Case basicly a variable assigned to hold a function call?
> > >
> > > Case A {do this}
> > > Case B {do that}
> > > Case C {do something else}
> > >
> > > If switch=A {Case:A)} else if switch=B {Case:B)}elseif switch=C {Case:C}
> > >
> > > start process
> > > do Case;
> > > end process
> >
> > This syntax would probably be more suitable for javascript.
> >
> > Case(A) {do this}
> > Case(B) {do that}
> > Case(C) {do something else}
> >
> > If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
> >
> >
> > setTimeout(function(){Case(x);}, 300);
> >
> > Well i know that x is normally a function parameter, and there is no syntax appropriate but since Case probably a reserved word i see no problem with it.
> >
> > I think it is rather beautiful in its simplicity?
>
> Well maybe you lke this syntax better.
>
> Case:A {do this}
> Case:B {do that}
> Case:C {do something else}
>
> If (switch==A) {x=A)} else if (switch==B) {x=B)} elseif (switch==C) {x=C}
>
>
> setTimeout(function(){Case:(x);}, 300)
Of course this is all my personal preferences but it is fucking simple...
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web