Closed refi64 closed 8 years ago
It will take me some time to review all this, but I'm not ignoring it.
As a point of general style I like to keep lines under 100 columns; makes it nicer to work with code on smaller screens. I've done some minor reformatting and simplification in 95bbd151fea715302c093f434bb878343a46e6c6 to this effect.
I think there must be a simpler approach to 'window'. The negative-window cases seem likely to me to be an artefact of the implementation rather than intentional. If you have a rationale otherwise I'm open to suggestions.
@JohnEarnest Ah, you use tabs. Sorry; I didn't realize it and just used spaces...
As for the negative-and-zero window cases, I agree that they might not be intentional, but I implemented them anyway for consistency, at least until k6 changes/fixes their behavior.
@JohnEarnest
I like to keep lines under 100 columns
What is your opinion of more densely packed code without most unnecessary spaces, braces, and semis?
There is a very fine balance to strike between conciseness and readability, and I don't think there's any hard-and-fast set of rules for it. I'll admit I am largely guided by my own sense of aesthetics. I try to avoid dropping semicolons and curly braces in JavaScript in particular, as I think it leads to the introduction of subtle bugs over the course of refactoring. I consider Automatic Semicolon Insertion a bug, honestly.
In general, none of these are too crazy. The only real issue was that I couldn't figure out a similarly concise way of removing duplicates for the examples once I updated
^
, but you usually beat me at code golf anyway. :)