www.digitalmars.com         C & C++   DMDScript  

D - switch voting

reply Ant <Ant_member pathlink.com> writes:
<joke>
(better viewed with monospaced font)
I now declare the end of the argumentation :)
the jury will now vote:

M - must
D - desirable
W - who cares
N - NO

| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
| M - 2    | M - 0    | M - 0     | Total
| D - 0    | D - 1    | D - 0     |
| W - 0    | W - 0    | W - 1     |
| N - 1    | N - 0    | N - 0     |
+----------+----------+-----------+
|    M     |    D     |     W     | Ant
+----------+----------+-----------+
|    M     |          |           | MW
+----------+----------+-----------+
|    N     |          |           | WB
+----------+----------+-----------+

by multiple values I mean "case 1,3,43,19..23:"
seems to me that you shouldn't have implicit break
without multiple values.

I took the liberty to create two extra example voters
with ficticious initials (any relations to
D users is purelly coincitdental ;)
</joke>

(I guess what I really mean is that every body is saying the
same thing over and over again)

Ant
Dec 09 2003
next sibling parent reply "Matthew Wilson" <matthew.hat stlsoft.dot.org> writes:
|    M     |    M     |     M     | MW

(Actually all this does not apply to me, because I *always* write the
default. I do this reliably since I always write it immediately after I've
written switch. Interestingly, having an explicit, but empty, default causes
most C++ compilers to generate less efficient code, so in some "cases" it is
better to not have a default in there. But if you want to hear more about
that you'll have to buy the book! <g> )

"Ant" <Ant_member pathlink.com> wrote in message
news:br5h0m$u59$1 digitaldaemon.com...
 <joke>
 (better viewed with monospaced font)
 I now declare the end of the argumentation :)
 the jury will now vote:

 M - must
 D - desirable
 W - who cares
 N - NO

 | remove   |
 | runtime  | Implicit
 | throw on | break and|
 | missing  | multiple | Mandatory |
 | default  | values   | default   |
 +----------+----------+-----------+
 | M - 2    | M - 0    | M - 0     | Total
 | D - 0    | D - 1    | D - 0     |
 | W - 0    | W - 0    | W - 1     |
 | N - 1    | N - 0    | N - 0     |
 +----------+----------+-----------+
 |    M     |    D     |     W     | Ant
 +----------+----------+-----------+
 |    M     |          |           | MW
 +----------+----------+-----------+
 |    N     |          |           | WB
 +----------+----------+-----------+

 by multiple values I mean "case 1,3,43,19..23:"
 seems to me that you shouldn't have implicit break
 without multiple values.

 I took the liberty to create two extra example voters
 with ficticious initials (any relations to
 D users is purelly coincitdental ;)
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
Dec 09 2003
parent reply Ant <Ant_member pathlink.com> writes:
In article <br5jqr$12j4$2 digitaldaemon.com>, Matthew Wilson says...
Interestingly, having an explicit, but empty, default causes
most C++ compilers to generate less efficient code
I bet the compiler will add a jump (or branch) to the next instruction or something like that but with the speculative execution (or whatever the thing is called) the impact should be close to 0, well, even with direct execution the impact is close to 0, let's see: 1.7 MHz, assuming a short branch takes 4 clock cycles... I wouldn't mind too much with that, at least for the type of apps I'm writing. (Maybe I'm completly off, when I give up assembler I stop thinking on these things). Ant
Dec 10 2003
parent reply "Lars Ivar Igesund" <larsivar igesund.net> writes:
"Ant" <Ant_member pathlink.com> wrote in message news:br7jm0

 to 0, let's see: 1.7 MHz, assuming a short branch takes 4 clock cycles...
Wow, your computer is ooooold! :) (Sure you don't want to do s/M/G/g?) Lars Ivar Igesund
Dec 10 2003
parent reply Ilya Minkov <midiclub tiscali.de> writes:
Lars Ivar Igesund wrote:
 "Ant" <Ant_member pathlink.com> wrote in message news:br7jm0
 
to 0, let's see: 1.7 MHz, assuming a short branch takes 4 clock cycles...
 Wow, your computer is ooooold! :)
GRRRRRRH! My computers are all under 700 MHz. My usual development can runs 233 MHz P-MMX. Besides, some CPUs are faster than the others, specifically by a 1,5 times "fake boost" of Pentium 4. ;) This is also reflected in the marketing names of newer Athlon CPUs, though they actually run with relatively low frequencies. Do you want to give us all some newer faster computers? -eye
Dec 11 2003
next sibling parent Berin Loritsch <bloritsch d-haven.org> writes:
Ilya Minkov wrote:
 Lars Ivar Igesund wrote:
 
 "Ant" <Ant_member pathlink.com> wrote in message news:br7jm0

 to 0, let's see: 1.7 MHz, assuming a short branch takes 4 clock 
 cycles...
 Wow, your computer is ooooold! :)
GRRRRRRH! My computers are all under 700 MHz. My usual development can runs 233 MHz P-MMX.
Let's see, I just retired a P-II 300 for a dual P-III 400. Roughly the same. I also have a laptop that runs at 1Ghz. All in all, if you are running more than that you probably aren't using it to its fullest potential.
Dec 11 2003
prev sibling parent reply "Lars Ivar Igesund" <larsivar igesund.net> writes:
"Ilya Minkov" <midiclub tiscali.de> wrote in message
news:br9npm$1aeo$1 digitaldaemon.com...
 Lars Ivar Igesund wrote:
 "Ant" <Ant_member pathlink.com> wrote in message news:br7jm0

to 0, let's see: 1.7 MHz, assuming a short branch takes 4 clock
cycles...
 Wow, your computer is ooooold! :)
GRRRRRRH! My computers are all under 700 MHz. My usual development can runs 233 MHz P-MMX.
No reason to be angry. 233 MHz is still 150 times faster than 1.7MHz... Lars Ivar Igesund
Dec 11 2003
parent reply Ilya Minkov <minkov cs.tum.edu> writes:
Lars Ivar Igesund wrote:
 No reason to be angry. 233 MHz is still 150 times faster than 1.7MHz...
Whoops! An oversight!!! LOLROTFL :D My first computer was a speccy at 4 MHz. :) 1.7 MHz looks like a pocket calculator frequency. sorry. :) -eye
Dec 12 2003
parent reply Berin Loritsch <bloritsch d-haven.org> writes:
Ilya Minkov wrote:

 Lars Ivar Igesund wrote:
 
 No reason to be angry. 233 MHz is still 150 times faster than 1.7MHz...
Whoops! An oversight!!! LOLROTFL :D My first computer was a speccy at 4 MHz. :) 1.7 MHz looks like a pocket calculator frequency. sorry. :)
Hey! THat's still faster than my C64!
Dec 12 2003
parent Ilya Minkov <minkov cs.tum.edu> writes:
Berin Loritsch wrote:
 Hey!  THat's still faster than my C64!
Though it only ran at 1 MHz, the CPU was quite a bit more efficient. Take your C64 or VICE and goto http://www.smash-designs.de/c64demo.html I happen to know their musician. You will see realtime raytracing (in "Decade") and all kinds of *really* impossible stuff!!!!!!! BTW, "Second Reality" is a C64 port of a legendary PC demo from 1992 which originally requiered a 486 with 40 MHz!!!!!! Check it out and you will never want to use your PC again, full of overbloated and inefficient software, and multi-gigabyte software development kits! Unless you want to view the PC demos from Smash Designs...
Dec 12 2003
prev sibling next sibling parent J C Calvarese <jcc7 cox.net> writes:
I wanna vote, too!

|    M     |    M     |     N     | JCC

Let's make it easy to program in D.  If the programmer knows he needs to 
  handle every case he can use "default: assert(0);" or whatever 
solution he prefers.  We're all grown-ups here, right?


Justin

Ant wrote:
 <joke>
 (better viewed with monospaced font)
 I now declare the end of the argumentation :)
 the jury will now vote:
 
 M - must
 D - desirable
 W - who cares
 N - NO
 
 | remove   |
 | runtime  | Implicit
 | throw on | break and|
 | missing  | multiple | Mandatory |
 | default  | values   | default   |
 +----------+----------+-----------+
 | M - 2    | M - 0    | M - 0     | Total
 | D - 0    | D - 1    | D - 0     |
 | W - 0    | W - 0    | W - 1     |
 | N - 1    | N - 0    | N - 0     |
 +----------+----------+-----------+
 |    M     |    D     |     W     | Ant
 +----------+----------+-----------+
 |    M     |          |           | MW
 +----------+----------+-----------+
 |    N     |          |           | WB
 +----------+----------+-----------+
 
 by multiple values I mean "case 1,3,43,19..23:"
 seems to me that you shouldn't have implicit break
 without multiple values.
 
 I took the liberty to create two extra example voters
 with ficticious initials (any relations to
 D users is purelly coincitdental ;)
 </joke>
 
 (I guess what I really mean is that every body is saying the
 same thing over and over again)
 
 Ant
Dec 09 2003
prev sibling next sibling parent Hauke Duden <H.NS.Duden gmx.net> writes:
Ok, it was a joke, but what the hell...

For the record:

| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    M     |    D     |     M     | HD
+----------+----------+-----------+



Hauke
Dec 09 2003
prev sibling next sibling parent Dan Liebgold <Dan_member pathlink.com> writes:
Oh, ok.

| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    W     |    M     |     N     | DL
+----------+----------+-----------+
Dec 09 2003
prev sibling next sibling parent reply Patrick Down <pat codemoon.com> writes:
| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    N     |    D     |     N     | PD
+----------+----------+-----------+
Dec 09 2003
parent "Sean L. Palmer" <palmer.sean verizon.net> writes:
| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    M     |    D     |     D     | SP
+----------+----------+-----------+
Dec 10 2003
prev sibling next sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    M     |   D     |     M     | CS
+----------+----------+-----------+
"Ant" <Ant_member pathlink.com> wrote in message
news:br5h0m$u59$1 digitaldaemon.com...
 <joke>
 (better viewed with monospaced font)
 I now declare the end of the argumentation :)
 the jury will now vote:

 M - must
 D - desirable
 W - who cares
 N - NO

 | remove   |
 | runtime  | Implicit
 | throw on | break and|
 | missing  | multiple | Mandatory |
 | default  | values   | default   |
 +----------+----------+-----------+
 | M - 2    | M - 0    | M - 0     | Total
 | D - 0    | D - 1    | D - 0     |
 | W - 0    | W - 0    | W - 1     |
 | N - 1    | N - 0    | N - 0     |
 +----------+----------+-----------+
 |    M     |    D     |     W     | Ant
 +----------+----------+-----------+
 |    M     |          |           | MW
 +----------+----------+-----------+
 |    N     |          |           | WB
 +----------+----------+-----------+

 by multiple values I mean "case 1,3,43,19..23:"
 seems to me that you shouldn't have implicit break
 without multiple values.

 I took the liberty to create two extra example voters
 with ficticious initials (any relations to
 D users is purelly coincitdental ;)
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
Dec 09 2003
parent Georg Wrede <Georg_member pathlink.com> writes:
| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    D     |    M     |     D     | GW
+----------+----------+-----------+

Mandatory default of course makes the runtime
throw obsolete. 

"Ant" <Ant_member pathlink.com> wrote in message
news:br5h0m$u59$1 digitaldaemon.com...
 <joke>
Dec 10 2003
prev sibling next sibling parent reply Andy Friesen <andy ikagames.com> writes:
Ant wrote:

 <joke>
 [...]
 </joke>
 
 (I guess what I really mean is that every body is saying the
 same thing over and over again)
 
 Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o -- andy
Dec 10 2003
next sibling parent Ilya Minkov <minkov cs.tum.edu> writes:
Andy Friesen wrote:

 The only place I've ever even used switch/case in D is either WndProc, 
 or some similar message enumeration. (SDL, enet, etc)  The "throw on no 
 default" thing has caught me exactly once, and it was an easy fix.
Yup. It's good for what it's worth.
 I am stunned beyond description that this issue has raised so much 
 discussion.  What's the big deal? O_o
Isn't it always like that with flamewars... I think that Mathew started it, but he wouldn't if i didn't mention it earlier on. :( BTW, we must flame Mathew not to use "alias int boolean" in his libraries. ;) -eye
Dec 10 2003
prev sibling parent reply "Matthew Wilson" <matthew.hat stlsoft.dot.org> writes:
"Andy Friesen" <andy ikagames.com> wrote in message
news:br7bb7$mgl$1 digitaldaemon.com...
 Ant wrote:

 <joke>
 [...]
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable. Therefore, if you port any non-trivial apps you cannot, in-principle, be certain that your application is not broken. The only practical measures you have are code coverage testing, and thorough reviews. Anyone who thinks these, or indeed any testing measures, can ever be done to completion needs to read a little Glass ("Facts and Fallacies of Software Engineering"). Given that premise (and if you don't accept it, you either haven't worked on big systems, or have an unreasonable faith in your own abilities beyond that of anyone else in the field, or you are genuinely a genius which the rest of are not), there are two separate issues: 1. If you write new code that is not ported-across-C, then it's arguable that the throw-on-no-default is valid. I certainly would never want to introduce that into a new language, but I accept this is a POV issue. 2. If you are porting C or C++ across, D changes the semantics without warning. Given that, and the complexity issue mentioned above, this means that D is, in-principle, not a suitable language to port C or C++ from. Since: a) it's better to detect errors at compile-time, and b) for D to succeed it has to be able to safely and sensibly port code in from many other languages, but especially C and C++ (along with Java and .NET), and c) I personally want D to succeed a very great deal - I like it, I intend to contribute several more libraries over the next six months, I want to use it professionally, I want to write a book about it in the near future - then I am just dumbfounded that the compile-time option is not the one used. The only reason I can see for the current implementation is that it is one of Walter's (self-)convenient shortcuts, and the only reason I can think that what seems about 40% of the posters like the current scenario is that (i) they are coming from other languages, and (ii) they don't care about porting from C or C++. Both of these positions are reasonable and respectable; we want people to come to D from all languages. But surely in any situation where a given semantic of the language would please some and confound others, the best approach will always be to make behaviour explicit? When the situation is reversed (I cannot think of an example off-hand) I can assure you I will still be in the make-life-a-teensy-bit-more-difficult-at-compile-time camp, even if it's me to "suffer" in that case. Cheers Matthew
Dec 10 2003
parent reply Patrick Down <Patrick_member pathlink.com> writes:
In article <br7vc1$1ltd$1 digitaldaemon.com>, Matthew Wilson says...
"Andy Friesen" <andy ikagames.com> wrote in message
news:br7bb7$mgl$1 digitaldaemon.com...
 Ant wrote:

 <joke>
 [...]
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable. Therefore, if you port any non-trivial apps you cannot, in-principle, be certain that your application is not broken. The only practical measures you have are code coverage testing, and thorough reviews. Anyone who thinks these, or indeed any testing measures, can ever be done to completion needs to read a little Glass ("Facts and Fallacies of Software Engineering").
No, a release build of the program will have the runtime throw compiled out. If a programmer ports over a switch statement without a default then yes a debug build might unexpectedly break. The release build will be no different than the original C semantics.
Dec 10 2003
next sibling parent reply "Matthew Wilson" <matthew.hat stlsoft.dot.org> writes:
 <joke>
 [...]
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable.
Therefore,
if you port any non-trivial apps you cannot, in-principle, be certain
that
your application is not broken. The only practical measures you have are
code coverage testing, and thorough reviews. Anyone who thinks these, or
indeed any testing measures, can ever be done to completion needs to read
a
little Glass ("Facts and Fallacies of Software Engineering").
No, a release build of the program will have the runtime throw compiled
out.
 If a programmer ports over a switch statement without a default then yes a
 debug build might unexpectedly break.  The release build will be no
 different than the original C semantics.
I see. Well that's both good and bad. It's good, because a program will not be broken (in release mode) that should not be broken. It's bad because a program that should be broken will likely not be, since debug testing is very unlikely to provide full coverage (Glass again; OT: I think this is the best software engineering book I've ever read, and heartily commend it to all). I know half of you think I'm living in cloud cuckoo land, so this'll probably just fly off into the aether, but this situation (compiled out in release) actually adds to the weight of the argument that the default should be mandatory. :( Cheers Matthew
Dec 10 2003
next sibling parent Patrick Down <Patrick_member pathlink.com> writes:
In article <br86vs$21s4$1 digitaldaemon.com>, Matthew Wilson says...
 <joke>
 [...]
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable.
Therefore,
if you port any non-trivial apps you cannot, in-principle, be certain
that
your application is not broken. The only practical measures you have are
code coverage testing, and thorough reviews. Anyone who thinks these, or
indeed any testing measures, can ever be done to completion needs to read
a
little Glass ("Facts and Fallacies of Software Engineering").
No, a release build of the program will have the runtime throw compiled
out.
 If a programmer ports over a switch statement without a default then yes a
 debug build might unexpectedly break.  The release build will be no
 different than the original C semantics.
I see. Well that's both good and bad. It's good, because a program will not be broken (in release mode) that should not be broken. It's bad because a program that should be broken will likely not be, since debug testing is very unlikely to provide full coverage (Glass again; OT: I think this is the best software engineering book I've ever read, and heartily commend it to all). I know half of you think I'm living in cloud cuckoo land, so this'll probably just fly off into the aether, but this situation (compiled out in release) actually adds to the weight of the argument that the default should be mandatory. :(
Ok lets look at the possibilities here. Two switch statement types: S1) All values are ok even if they are not explicitly handled. default: break; S2) Only the values handled in the switch statement are valid. default: assert(0); TC - Testing/A value that does not match a case is given to the switch statement TN - Testing/A value that does not match a case is not given to the switch statement RV - Production version/A value that does not match a case is given to the switch statement Now lets look at the results of not requiring a default and then the results of not requiring a default No default required/programmer forgets the default S1 ========================================== TC - Exception happens. Programmer puts in: default break; TN - No problem all values are ok anyway RV - No problem all values are ok S2 ========================================== TC - Exception happens. Programmer investigates reason for invalid switch value. Fixes problem. TN - Testing misses the error above RV - The program ends up in some unknown state Default required S1 ========================================== TC - No problem all values are ok TN - No problem all values are ok RV - No problem all values are ok S2 ========================================== TC - Exception happens, Programmer investigates reason for invalid switch value. Fixes problem. TN - Testing misses the error above RV - The program ends up in some unknown state The end result is mostly the same whether the default is required or not. I do understand that by requiring the default you are trying to make the programmer think about the completeness of the case statement.
Dec 10 2003
prev sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
What book ?

C
"Matthew Wilson" <matthew.hat stlsoft.dot.org> wrote in message
news:br86vs$21s4$1 digitaldaemon.com...
 <joke>
 [...]
 </joke>

 (I guess what I really mean is that every body is saying the
 same thing over and over again)

 Ant
The only place I've ever even used switch/case in D is either
WndProc,
 or some similar message enumeration. (SDL, enet, etc)  The "throw on
no
 default" thing has caught me exactly once, and it was an easy fix.

 I am stunned beyond description that this issue has raised so much
 discussion.  What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable.
Therefore,
if you port any non-trivial apps you cannot, in-principle, be certain
that
your application is not broken. The only practical measures you have
are
code coverage testing, and thorough reviews. Anyone who thinks these,
or
indeed any testing measures, can ever be done to completion needs to
read
 a
little Glass ("Facts and Fallacies of Software Engineering").
No, a release build of the program will have the runtime throw compiled
out.
 If a programmer ports over a switch statement without a default then yes
a
 debug build might unexpectedly break.  The release build will be no
 different than the original C semantics.
I see. Well that's both good and bad. It's good, because a program will
not
 be broken (in release mode) that should not be broken. It's bad because a
 program that should be broken will likely not be, since debug testing is
 very unlikely to provide full coverage (Glass again; OT: I think this is
the
 best software engineering book I've ever read, and heartily commend it to
 all).

 I know half of you think I'm living in cloud cuckoo land, so this'll
 probably just fly off into the aether, but this situation (compiled out in
 release) actually adds to the weight of the argument that the default
should
 be mandatory. :(

 Cheers

 Matthew
Dec 10 2003
parent "Matthew Wilson" <matthew.hat stlsoft.dot.org> writes:
 What book ?
<snip>
code coverage testing, and thorough reviews. Anyone who thinks these,
or
indeed any testing measures, can ever be done to completion needs to
read a
little Glass ("Facts and Fallacies of Software Engineering").
<snip>
 very unlikely to provide full coverage (Glass again; OT: I think this is
the
 best software engineering book I've ever read, and heartily commend it
to all).
Dec 10 2003
prev sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Patrick Down wrote:
 In article <br7vc1$1ltd$1 digitaldaemon.com>, Matthew Wilson says...
 
"Andy Friesen" <andy ikagames.com> wrote in message
news:br7bb7$mgl$1 digitaldaemon.com...

Ant wrote:


<joke>
[...]
</joke>

(I guess what I really mean is that every body is saying the
same thing over and over again)

Ant
The only place I've ever even used switch/case in D is either WndProc, or some similar message enumeration. (SDL, enet, etc) The "throw on no default" thing has caught me exactly once, and it was an easy fix. I am stunned beyond description that this issue has raised so much discussion. What's the big deal? O_o
The reason people are hot under the collar is that the new semantics introduces potential breakages to code that are not predictable. Therefore, if you port any non-trivial apps you cannot, in-principle, be certain that your application is not broken. The only practical measures you have are code coverage testing, and thorough reviews. Anyone who thinks these, or indeed any testing measures, can ever be done to completion needs to read a little Glass ("Facts and Fallacies of Software Engineering").
No, a release build of the program will have the runtime throw compiled out. If a programmer ports over a switch statement without a default then yes a debug build might unexpectedly break. The release build will be no different than the original C semantics.
When I first read this I thought you were recommending compiling in release mode to get rid of the runtime errors instead of adding a "default". (OK, I realize now that's not what you were suggesting.) I haven't thought much about debug vs release modes, but it seems absurd the situations that Walter wants to protect us from just fade away into the night when it's compiled in release mode. That's part of the reason why I think there should either be no error generated at all (my preference) or a compile-time error when a default is missing. Justin
Dec 10 2003
parent Antti =?iso-8859-1?Q?Syk=E4ri?= <jsykari gamma.hut.fi> writes:
In article <br8dmh$2c6n$1 digitaldaemon.com>, J C Calvarese wrote:
 No, a release build of the program will have the runtime throw compiled out.
 If a programmer ports over a switch statement without a default then yes a
 debug build might unexpectedly break.  The release build will be no
 different than the original C semantics.
When I first read this I thought you were recommending compiling in release mode to get rid of the runtime errors instead of adding a "default". (OK, I realize now that's not what you were suggesting.) I haven't thought much about debug vs release modes, but it seems absurd the situations that Walter wants to protect us from just fade away into the night when it's compiled in release mode.
One of my favourite misused CS quote is from Dijkstra: "Finally, it is absurd to make elaborate security checks on debugging runs, when no trust is put in the results, and then remove them in production runs, when an erroneous result could be expensive or disastrous. What would we think of a sailing enthusiast who wears his lifejacket when training on dry land, but takes it off as soon as he goes to sea?" This witty remark is famous because -- it's a witty remark. And sadly often is it so that a witty remark is adopted as a truth and as a basis of a belief. Now the analogy he makes, like any analogy in general, is an analogy not only because the similarity of the things that are compared, but also because their difference. And you could counter the argument by saying that sailing and programming are in fact quite different contexts. You might drown while encountering an exceptional situation while sailing and therefore it is expected that anyone in their sane mind would carry all the equipment possible to prevent that. In programming, however, usually nobody's life is at stake, particularly in one-shot and other non-critical applications. On the other hand, when lifes _are_ at stake, the amount of care and consideration put into the program more than just leaving the debug statements on. One must also compare the expected amount of bugs that can be reduced in the process of debugging to the expected amount of risks that can be reduced by training sailing on dry land, and one must compare the processes that are used in order to increase the reliability. And take into consideration the desired level of reliability, and time to achieve it, and the resources available to achieve it. Are the costs that the debug statements lead to tolerable? There must be balance in all things. Or then again, you could just counterattack with another analogy: What would we think of a bicycler who uses training wheels while learning to drive the bicycle, but takes them off as soon has he has learned enough to stay in balance? -Antti
Dec 10 2003
prev sibling next sibling parent Antti =?iso-8859-1?Q?Syk=E4ri?= <jsykari gamma.hut.fi> writes:
| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
|    M     |    M     |     N     | AS

In article <br5h0m$u59$1 digitaldaemon.com>, Ant wrote:
 by multiple values I mean "case 1,3,43,19..23:"
 seems to me that you shouldn't have implicit break
 without multiple values.
This would seem reasonable. -Antti
Dec 10 2003
prev sibling next sibling parent reply Ant <Ant_member pathlink.com> writes:
M - must
D - desirable
W - who cares
N - NO

| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
| M - 7    | M - 5    | M - 3     | Total
| D - 1    | D - 5    | D - 2     |
| W - 1    | W - 0    | W - 1     |
| N - 1    | N - 0    | N - 4     |
+----------+----------+-----------+
|    M     |    D     |     W     | Ant
|    M     |    M     |     M     | MW
|    M     |    M     |     N     | JCC
|    M     |    D     |     M     | HD
|    W     |    M     |     N     | DL
|    N     |    D     |     N     | PD
|    M     |    D     |     D     | SP
|    M     |    D     |     M     | CS
|    D     |    M     |     D     | GW
|    M     |    M     |     N     | AS
+----------+----------+-----------+
Dec 11 2003
parent Ant <Ant_member pathlink.com> writes:
I should add a comment:

Of course this is not a democracy.
Of course if you want a perfect language
you need to design it your self.

Walter has a perfect language, we don't.

Mr. Bright, :)
joke or not,
democracy or not,
we do have close to 10/2
ratio against you idea... 

Ant

M - must
D - desirable
W - who cares
N - NO

| remove   |
| runtime  | Implicit
| throw on | break and|
| missing  | multiple | Mandatory |
| default  | values   | default   |
+----------+----------+-----------+
| M - 8    | M - 5    | M - 3     | Total
| D - 1    | D - 6    | D - 2     |
| W - 1    | W - 0    | W - 1     |
| N - 1    | N - 0    | N - 5     |
+----------+----------+-----------+
|    M     |    D     |     W     | Ant
|    M     |    M     |     M     | MW
|    M     |    M     |     N     | JCC
|    M     |    D     |     M     | HD
|    W     |    M     |     N     | DL
|    N     |    D     |     N     | PD
|    M     |    D     |     D     | SP
|    M     |    D     |     M     | CS
|    D     |    M     |     D     | GW
|    M     |    M     |     N     | AS
|    M     |    D     |     N     | bs
+----------+----------+-----------+
Dec 11 2003
prev sibling next sibling parent Benji Smith <dlanguage xxagg.com> writes:
|    M    |    D    |     N     | bs
Dec 11 2003
prev sibling next sibling parent J Anderson <REMOVEanderson badmama.com.au> writes:
|    N     |    D     |     N     | JA
Dec 11 2003
prev sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
|    D     |    M     |     D     | CS

—————————————————————————
Carlos Santander
|    D     |    M     |     D     | CS

—————————————————————————
Carlos Santander
Dec 12 2003