Hiroshima's "Little Boy": the first in history nuclear explosive device used to attack an enemy faction. According to figures published in 1945, 66,000 people were killed as a direct result, and 69,000 were injured to varying degrees. Total amount of nuclear fuel on site: approximately 600 to 860 milligrams of matter. Milligrams! And a big part of that got aniquilated in the explosion.
Chernobil: one nuclear reactor explodes spreading radioactive materials in aerosol form. Total amount of nuclear fuel on site: 180 tonns.
Fukushima: six nuclear reactors, one of them a plutonium reactor, gets severilly damaged after several eathquakes and a tsunami hits the nuclear plant, starts spreading radioactive materials in aerosol form and dumping tonns of contaminated water to the sea. Total amount of nuclear fuel on site: 7,200 tonns.
Call me pesimistic, but I think this is an entirelly different leage, one that may make Chernobil look like a propane gas escape. And I wish I'm wrong...
Well, in fact you could serialize/unserialize the objects and store them somewhere, making use of the "magic" functions __sleep() and __wakeup(), if I recall correctly. But yes, as soon as the web server ends the response or the script gets to the end, it's finished
In this case, do_something_finally() will never be called.
try {
throw new IOException("bad");
} catch ( NotAnIOException e) {
System.out.println("This is something I expected to happen.");
}
do_something_finally();
With a finally block, it would be, and the IOException would then be bubbled up to the caller. Without finally, you need to do this:
try {
throw new IOException("bad");
} catch ( NotAnIOException e) {
System.out.println("This is something I expected to happen.");
} catch (Exception e) {
do_something_finally();
throw e;
}
do_something_finally();
No, you're right. The code in the above example behaves differently than the finally version in the case where UNLOCK TABLE throws something.
This seems to be an example where the hack is preferred over the correct solution. The hack in this case is going to work almost all of the time.
I fail to see how throwing up an example of a hack is a good way to argue for or against a language feature. Generally speaking if the language is decent enough there is always a way to hack in some new semantics yourself (I'm looking at you, anonymous inner Java classes for closures), but language features allow you to compose and represent those semantics more elegantly. So, the argument shouldn't be "can we do this already with a hack" it should be "is this hack common enough that we should fix it."
The point the author is making is almost self-evidentally against his own conclusion: here's a common pattern that is broken, so we should not include this as a language feature???
> The point of finally is that it's always, always, always executed.
Except when it's not. If you design a large system with the assumption that finally blocks always execute, you could end up with some data integrity issues when you get a power outage, an exception in your finally clause, a hung machine, or any other number of errors that a finally clause does nothing to address.
The finally clause is very useful, but to say that it will always (x3!) execute is somewhat perilous.
According to the linked article, the second one will not run do_something_finall() since it is after the return statement. The second one however will...
Note, this does seem to be the case for javascript:
Your first example will do_something_finally() before returning y and exiting the try-scope and method (unless an error has occurred). Your second example will return y without invoking do_something finally() (unless an error has occurred).
If an error occurs before "return y", both will behave equally.
Basically the finally-clause is guaranteed to be run always. This means that you can put your resource-cleanup logic there and know it will be invoked if errors occur or not, without the need to duplicate that logic within the catch-block.
Especially when the catch-block is set to rethrow (or just outright omitted) this saves the programmer a lot of time, code-duplication and makes the code more readable.
The reasons given for omitting it by the PHP team is factually incorrect and shows that they clearly don't understand how the feature is supposed to work. With that hindsight, it would be interesting to see how it would have been implemented if they had gone forward adding it instead of saying "no". It could have become a highly fascinating monster.
Yeah, I know. But working on a wood statue with a humble knife should not be an excuse for the chainsaw guy to call you a dumb bastard for not be doing the statue with the chainsaw, "like proper men should do". Yes, the quoted phrase was actually heard on my office. Go figure...
( ...and I don't have anything against ruby. I'm learning rails. www.railsforzombies.com is great. In fact, my php is made on cakephp and lithium, which are pretty similar to rails... )
No, he means when you open your browser and type "www.piratebay.p2p", some program under the hood will 1) connect to a tracker, 2) get the ip from the tracker in a similar fashion to what bittorrent does to get seeds and 3) continue with the navigation as always.
By connecting to this tracker, the translation from "www.someplace.com" to 12.13.14.15 (what the machine really understands) is done regardless what the ICANN dns says. No way to redirect to a "this page is closed" server, no web page can be cut off the internet. Check mate.
This game is far from over. Filtering web requests based on the requested host is enough to disrupt this, and even SSL requests send cleartext hosts (sadly).
You are right, this war is far from over. Just I wasn't considering the whole war, but this battle, this game in particular. We'll see how the next battle starts, and then we'll play our moves the best we can, but this time, in this game to be precise, I think is a check mate. And a speedy one, too. Maybe.
In case this gives you an idea: in my linux laptop I just have two different users in the laptop, one that is configured to use a local tor proxy and another "non protected". Depending of if I'm out in the open or at home I use one of another. When I need some data from my protected user when in "unprotected mode" I sftp:// myself, but usually I do it the other way (unprotected data from protected mode). Much simpler, I think...
I didn't find anything nice for linux when I was looking for one a few days ago.
I ended up buying a docking station / stand for my ipod touch, and using the Pomodoro Timer from Navel Labs. I like having it on a seperate tiny screen so that I don't have to go hunting for the application whenever I want to see how much time is left, etc..
Chernobil: one nuclear reactor explodes spreading radioactive materials in aerosol form. Total amount of nuclear fuel on site: 180 tonns.
Fukushima: six nuclear reactors, one of them a plutonium reactor, gets severilly damaged after several eathquakes and a tsunami hits the nuclear plant, starts spreading radioactive materials in aerosol form and dumping tonns of contaminated water to the sea. Total amount of nuclear fuel on site: 7,200 tonns.
Call me pesimistic, but I think this is an entirelly different leage, one that may make Chernobil look like a propane gas escape. And I wish I'm wrong...