Earlier quoted context omitted.
There are only four options for removing a block of code you no longer want to use: 1. Add a comment around the whole block. This may not always work, as comments within the block may need to be removed. 2. Add string delimiters before and after the block, making the block an in-place string literal. This can be broken by strings within the block. 3. Use a goto statement to skip the block. This is a pretty good metho…
5) delete it from your code. You do have source control, so you will be able to recover the code later. If you want to leave evidence, add a comment: -- Removed Foo handling in revision ... because of ... That should be rare, though. For temporary disabling, I tend to do: const disableFooForDebugging = true if( disableFooForDebugging) That makes it easier to recognize and correct accidental checkins.
The Anti-Human Consequences of Static Typing
41–50 of 67 posts
Re: The Anti-Human Consequences of Static Typing
#42Earlier quoted context omitted.
> mathematical proofs are not based on logic Mathematical proofs are explicitly logical statements, if they aren't based in logic they aren't proofs by definition. Mathematical intuition is what leads us to ideas but it's only within the framework of formal reasoning that we "know" anything within mathematics. Poincare said it nicely: "It is by logic we prove, it is by intuition that we invent."
If you really believe this, you should try to translate any contemporary (published) mathematical proof into a real logic, like Coq. It is hard and people earn PhDs doing this because most proofs are so intuition heavy in the first place.
Re: The Anti-Human Consequences of Static Typing
#43Funny coincidence, just today I wondered if there's such a thing as a statically typed Lisp, and stumbled upon Racket with types [1] I think another good example of a optionally static typed language would be Julia, where you can add types, and if you add them, the compiler will try to leverage that information to optimize your code [2]. I've used dynamic and static languages mixed for most of my life (Javascript, Py…
Re: The Anti-Human Consequences of Static Typing
#44Are there any languages that have a type mismatch warning rather than a type mismatch error? Something like how gcc warns about incompatible pointer types when compiling C programs, but lets you use them if you insist, but for all types?
Re: The Anti-Human Consequences of Static Typing
#45Earlier quoted context omitted.
Static typing stopped the compile because the program does something foolish. But static typing would also stop the compile in situations where mixing types was not foolish. Static typing says you must give a definite type to every variable and every expression; but that's not always the best way to write your program. (To take a simple example from Python, there are plenty of cases where you want a function to retur…
> To take a simple example from Python, there are plenty of cases where you want a function to return either a string, say, or None, depending on whether it is able to find a string meeting some set of criteria, and you can't use the empty string as your "not found" value because empty strings are semantically significant for your application. Static typing is not a problem here. Static type with an inadequate type s…
Re: The Anti-Human Consequences of Static Typing
#46Vastly more type errors (i.e., conditions which cause the program not to hold the property checked by the type system) are caused by programmer error than by deliberate design; a strong, static type system, checked at compile time, helps ensure that a whole class of relatively weak but trivially easy to write bugs do not find their way into the finished program. The programmer hours saved in not having to worry that some little-exercised code path will attempt to add an integer to a string, nor to write exhaustive tests covering every possible code path to make sure no integers get added to strings, adds up significantly over the program's lifecycle, from initial development through maintenance and support.
Be kind to your programmers. Use a statically-typed language.
Re: The Anti-Human Consequences of Static Typing
#47I agree, we need to have far more human compilers. Perhaps, when I compiler runs across a type violation it just breaks out laughing at you. "HA HA HA! You idiot! You defined this variable as a string, and then you tried to do arithmetic on it, WHAT WERE YOU THINKING?" Maybe the compiler can just complain about the user. "Seriously, this guy first gets me to make this integer, and that's cool, but then he starts to u…
Re: The Anti-Human Consequences of Static Typing
#48humans suck at verifying programs.
let's keep going with this, why do we only consider a program to be running when it's running on a machine!? humans can run programs as well!
Re: The Anti-Human Consequences of Static Typing
#49>The logic goes that if you reject "bad" programs then only "good" programs remain, and who would want to run "bad" programs anyways? I thought the logic was: if you reject all bad programs and some good programs, only good programs remain, is it not?
Re: The Anti-Human Consequences of Static Typing
#50This is inconsistent code to being with, though. You can't guarantee it "never" reaches the first branch, as much as you can't guarantee there aren't bugs in the conversion function, or on the underlying interpreter, or that machine details wouldn't make a big enough number wrap around and return negative. All in all, an inconsistent code branch hanging around is a bug even if it compiles.
This is more an evidence that "if" is evil rather than an argument about typing, really.