| « Prev | Page 1 | Page 2 | Next » |
|
function DoNothing()
{ Nothing(); } function Nothing() { } |
function DoNothing() |
Brillant! You've removed the WTF-ness. You're quite the party pooper. Now what do we talk about? |
Brrriiliant!! |
|
The real WTF would be if it did something.
|
|
Maybe one of them doesn't return anything, whereas the other has no side effects.
'scuse my language, I don't speak java |
|
Maybe they forgot to define what "doing nothing" entails and intended on filling it in at a later time...say, just before production release?
I would love to see their reasoning behind making nothing functions though. |
|
Doing nothing = waiting to eventually do something
|
|
I'm not seeing the wtf here. Obviously there's a difference between nothingness and not doing anything.
|
|
This must be som sort of bug-prevention. How many times have you heard the following?
"The application crashed, you did the last check-in, what did you change?" "Nothing" So by assuring a really harmless implementation of Nothing() such things should never occur... |
|
DoNothing should call Nothing though:
function DoNothing{ Nothing(); } |
|
Don't do what Donny don't does. Even if Donny Don't doesn't do anything.
|
|
Function MakeComment
{ } |
|
The person who wrote Nothing() didn't realize that somebody had already written it. A simple matter of duplicate code (for a dummy callback).
|
How about wooden tables, captcha, fist, and file not found? |
|
Entirely not enough recursion, global variables, magic numbers, or infinite loops...
|
|
"""python version"""
|
|
doNothing()
{ } dontDoNothing() { doNothing() ; } |
|
I have only one thing to add: ""
Captcha: tesla. man, I miss my old TV |
|
It's really just a clever deployment solution. See, who wants to go through that pesky compile step every time?
They just add calls this function and then insert code directly into it in memory at run time until it behaves as desired. |
|
function DoNothing()
{ // TODO: Inline assembler does not seem to work in JavaScript :-( // TODO: Find a different way to do nothing // asm { NOP }; } |
|
Very enterprisy.
Capta: Stinky.... ewww |
|
I have days that emulate this function.
|
|
http://imgs.xkcd.com/comics/exploits_of_a_mom.png
|
|
Of course, this should be:
|
Re: Not Doing Nothing
2007-10-24 11:24
•
by
Synonymous Coward
(unregistered)
|
|
Maybe it was written by someone who didn't know about the void operator.
function Nothing() { }
|
|
Compiles
Does what it says Does not have extra lines Does not need comments Does not waste nanoseconds Etc It's utopical |
|
Does exactly what it says on the tin!
|
|
the second function should be named doAnything(). When you doNothing, you don't doAnything. Then it would make complete sense that doAnything() does not get called by doNothing().
|
|
Maybe some crafty API takes two callbacks, say onFail and onFailFail. This way, if the function fails you can do failure handling in onFail. If onFail fails, you call onFailFail to log an error or something.
And the API is friendly enough to yell at you for using the same function for both. Obviously if onFail fails, you don't want to call it again! Are you trying to create an infinite loop? /Man, I'm totally going to put stuff like that n my next application just to give people a headache. |
|
There's nothing wrong with a function called Nothing or something of the sort. I've done it more than once.
It can make it clearer what a piece of code is doing. |
|
doAnything()
{ var h = Math.random(); for (var i=0; i < h; i++) { doNothing(); } } |
It's javascript, not java. Your only problems are: try with no catch, and null should be lowercase. And none of the variables you're using exist, but they could be defined at any time elsewhere, so it's a runtime error only.
It never occured to me that undefined was a specific entity that could be compared to itself. |
|
Both functions are clearly necessary to keep the code readable:
but
Really, who would want to read "do DoNothing()"? (Hey, what about "PLEASE DO NOTHING"?) |
Re: Not Doing Nothing
2007-10-24 12:00
•
by
Harrow
(unregistered)
|
Yes. Thank you. I could see that the code was wrong, but I couldn't quite see how to fix it. -Harrow. |
|
function DoNothing()
{ Do(); Nothing(); } function Do() { } function Nothing() { } |
|
Damn- I hope that function was well tested.
|
|
I thought this looked funny.
Found it in all the sites that we do. function nothing(){ return; } |
Re: Not Doing Nothing
2007-10-24 12:47
•
by
sweavo
(unregistered)
|
Oh cock it! You mean after all these years of avoiding JS like the plague it is, I've gone and written some for fun?! Enter your First Name: 20 Enter your last Name: 15 Your email address is: 35@javascript_sucks.com |
|
Empty functions are useful for overriding or specifying default event handlers in certain cases.
e.g. <a onclick="SomeThirdPartyLibrary.callThis()" href="javascript:DoNothing()" >click</a> |
|
...
I wont tell anyone. My Lips are sealed. Now i have to call a friend. (Evil laughg) Capacha: Ewww (When i will think of food that i dont like, i will think about this capacha) |
|
Positively (well, negatively) Heideggerian!
|
|
Perhaps they think the empty function in prototype is a WTF too? http://www.prototypejs.org/api/prototype
|
|
The solution is easy: DoNothing is a function. Nothing is a constructor for instances of Nothing. So you invoke it like that:
DoNothing(); var something = new Nothing(); |
Re: Not Doing Nothing
2007-10-24 13:43
•
by
Anon
(unregistered)
|
Obviously, if this were Java instead of JavaScript, it would be: public final class Utils {
And while that is a joke, it's unfortunately fairly normal, as this excerpt from Sun's current implementation java.awt.Component demonstrates: /** That is real, as anyone with Sun's JDK can verify by peeking in src.zip. |
|
Presumably Nothing uses these funtions.
I guess the author felt that it was good to know that they could DoNothing if they wanted to, which would be nice to know. |
| « Prev | Page 1 | Page 2 | Next » |