JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

Implement some K6 changes #50

Closed refi64 closed 8 years ago

refi64 commented 8 years ago

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. :)

JohnEarnest commented 8 years ago

It will take me some time to review all this, but I'm not ignoring it.

JohnEarnest commented 8 years ago

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.

refi64 commented 8 years ago

@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.

ngn commented 8 years ago

@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?

JohnEarnest commented 8 years ago

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.