-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Conversation
We need to do perf tests before merging. |
this makes me die inside (returning null) |
tail += '\\'; | ||
} | ||
(!tail && !isAbsolute) && (tail = '.'); | ||
(tail && trailingSlash) && (tail += '\\'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loloololol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick observation, but the second test of "tail" will always be true, so it could just be reduced to if (trailingSlash)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, I think you could save a few more chars by using ||
instead of &&
:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets just change it into 140bytes competition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull a _why and make everything as cryptic as possible, that's what good programmers do. job security ftw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(!tail && !isAbsolute) && (tail = '.');
tail||isAbsolute||tail='.';
Anything shorter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry. Really discussing like that about 5, respectively 2, lines of code? I can restore it, if you really want to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We told you not to do this kind of stuff in the last pull request :/
Sacrificing code readability to lower line count is not cool.
Sorry, WTF? These are changes for the sake of changes. You've broken every single JavaScript style guide, made source code ugly for no profit. And no, constructions you've used are not understandable for JS beginners. Also, can you demonstrate (with a test case, preferably) where using those new features throws an error or an warning? Or where using them would make our code better (faster/more DRY)? |
Are you serious? This is a continuation of my previous pull-request. The last time I committed, more changes were needed, that is, the committers themselves corrected the issues. #1804 - and some eloquent words would be appropriate. "You've broken every single JavaScript style guide," - really? I don't know if you really are capable of JS in the name of ECMAScript 5, if not, please, just keep quiet. (see strict mode and the given link). P.s.: I don't know what kind of people you are - in what environment do you get bitched by "developers" complaining about code, without constructively discussing it? This is getting crazy here - or you're just too decadent about people trying to keep up clean work. If you still don't get the code, please, get a real hobby. Anyway, Cheers to Poland. |
You're right, we should discuss the code, which I think others have done in the previous commits. The reality many of these changes are very awkward, core definitely could use a cleanup but changing if statements to expr statements is not any cleaner, nor are weird ternary ops with parenthesized conditions for no reason. I avoid strict mode so I dont know if the return null thing is necessary or not, if it is then JavaScript just got a little more sucky. |
My quick little test shows that always including a return value is not necessary: https://gist.github.com/1294126 |
Do you know the difference between "style guide" and "language specification"? From what I've seen, you're saying: "What, one 1000-pages-book that consists of one sentence violates basic style rules? It is valid english, you know!" |
Oh. So, ES5 automagically makes > 100 char lines nice? Cool feature.
Clean work? It's not a clean.
Bozo bit flipped. |
if (key || char) { | ||
this.emit('keypress', char, key); | ||
} | ||
return (key || char) ? this.emit('keypress', char, key) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About style: Why the extra indent? Do you think it looks good to indent the lines you wrote more than the lines others wrote? That's kind of selfish, you know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When changing the code, first, I removed "if (key || char) {" and "}", then completed the "this.emit('keypress', char, key);" to the given return-statement. I didn't want to express anything else, though. Didn't see that, I'm sorry.
Btw, you forgot to "fix" |
@thejh It's clean and strict anyway, so that joke does not work. |
@KenanSulayman it is? Oh, I'm sorry, it just looked to me like you wanted every function to return. |
@KenanSulayman said:
Can you tell me where it is explained? I cannot find it. |
As it seems, Komodo referenced the ECMAScript-specification in error. Anyway this is profilactic - a Mozilla-errorcheck explains, either returning nothing at all or if, in any case of the function flow something should be returned. (e.g. http://cl.ly/2N462X191l0m342O1f41) |
Errrmmm... no. Not if you know that nobody will look at the return value of the function because it's async and So, if you just blindly follow the hints of an error checking tool, you aren't the programmer, you are the computer. Sorry. |
@KenanSulayman - Neither Komodo nor Mozilla-errorcheck is ECMAScript's specification. |
@KenanSulayman - Can you close this request and divide it into some categories?
Then, please send each requests. And, Please remember @bnoordhuis's advice.
|
Sounds okay. +Edit: What's the problem anyway? There're no functional changes. Anyway |
@KenanSulayman The problem is that your changed code doesn't look the way many people are used to. Your code doesn't respect existing conventions. It doesn't even care. It contains a bunch of changes that most of the people here think of as reducing the beautifulness of the code (to express it in a nice way). I think that you didn't yet give us any reason for why those ugly |
The hostility in these comments is absurd. Take it down a notch, it's just code. |
@@ -447,7 +450,7 @@ Client.prototype.setBreakpoint = function(req, cb) { | |||
}; | |||
|
|||
Client.prototype.clearBreakpoint = function(req, cb) { | |||
var req = { | |||
req = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this for Pull Req #1
I marked 5 lines (yes... only 5) that are actually needed and should be seperated as a new pull request. I marked them with "Keep this for Pull Req #1" But I honestly do not think its worth the trouble unless you can demonstrate a performance improvement from it. But if its purely for cosmetic purposes to not make komodo complain (and I use komodo too, I just ignore em :P), then its absolutely not necessary as future commits will not honor it and it will be pointless. If a function is not expected to return anything, then theres no reason to put a return statement on everything. Returning null vs returning undefined gains you nothing if your not using that result. Id be willing to think it would actually be detrimental to performance to add them where return values are not expected. |
@thejh Well said, thank you. I will rethink the changes of the @contra Kind of. When I saw it, it scared the shit out of me. Seemed like Facebook of Coding with Punch-Button to me. @aikar Thank you, really much! New pull-request on its way. |
Closing. @aikar already pointed out the good bits, please submit those as a new pull request. Not interested in the 'return / return null' changes. |
This fixes strict-warnings & errors.
This time, the source is understandable to at least Javascript beginners and is ready to go, again, breaks no tests which aren't already broken. This commit is required as new features of V8 require strict mode, which can't be, yet, given the unchanged lib-files, as they throw strict-warnings (no return of function, et al.) and strict-errors (redeclaration of variables).
In total, 19 files changed, there are 240 insertions. and 219 deletions.
Cheers, finally.