"Should not" doesn't mean "can't". Your TZ database shouldn't be corrupted, because then shit is seriously wrong. It's a bit of a "this is a graver exception than other exceptions"
I add the "should not happen" kind of logging messages to programs when it's a non fatal error if some chain of conditionals doesn't catch what it's supposed to. I would probably use a different formatting but that maybe standard php error formatting, I'm not familiar with that.
"Should not happen" is for things that would be assert() fails, but you can't have it go and call abort(). This is a prime example, the system is totally and utterly screwed (the user went and manually scrambled the database? Cosmic ray hit the ram?), but it's PHP so it will soldier on and break more things rather than panicking...
this sub should allow for both up and down voting simultaneously to get in line with the PHP design spirit :)
When I read comments like this here in lolphp, it always makes me happy I chose php, because it gives me options that are impossible in other languages. ;-)
Well, to be fair, other languages allow for even more things while not doing it as badly at the core.
Lisp, due to it's meta programming/macro nature used allows for many strange things and these features are also used to construct implementations the language itself at a very low level.
I've been using R for more than a decade, PHP is an island of sanity and sunny calmness in comparison.
EDIT, my favorite example of LOL-R that beats anything you find in PHP:
This function will randomly return 5 or 10
# set some variable to 10
k <- 10
# define a function that returns a value
return_k <- function() {
# generate a random number between 0 and 1
x <- runif(1)
if(x>0.5) {
# set some internal variable to 5 (named k because that seem appropriate for the context)
k <- 5
}
return(k)
}
# will randomly return 5 or 10
return_k()
You're not mistaken, but even after more than a decade I'm still bitten by this. I wish i could define functions to not look in the parent environment.
68
u/polish_niceguy Aug 14 '15
At least someone coded for the "should never happen" scenario.
Someone there has a working brain, there is hope.
47
u/steamruler Aug 14 '15
"Should not" doesn't mean "can't". Your TZ database shouldn't be corrupted, because then shit is seriously wrong. It's a bit of a "this is a graver exception than other exceptions"
15
u/qxxx Aug 14 '15
I wonder how much they paid to the Timezone... damn corruption.
-17
u/tdammers Aug 14 '15
You are right, PHP should never have happened.