Hacker News new | past | comments | ask | show | jobs | submit login

Wow, I love the flow!

Except JSLint. JSLint barfs all over otherwise valid JavaScript and provides really unhelpful error messages. For a minute, I thought that I forgot how to write valid JavaScript.... Hate! Hate! Hate! You're teaching folks to program, not write syntactically pure JS.

But drop that and the experience is great.




(Creator here) Ha, yeah JSLint really provokes strong emotions.

Before I added in JSLint, if you misplaced one semicolon or forgot a parentheses, none of the tests would run and it would just say "program failed". That was incredibly frustrating to me. I figured that if I was getting frustrated, and I was the creator of the tests, then random users would be REALLY frustrated. So I added in JSLint. Now you get line and column numbers for exactly where the syntax broke down.

I'm actually happy following all of JSLint's suggestions. But my first test user, my wife, had other thoughts. She filled out her first answer, saw the whitespace errors, and said "hells no". So I turned off the whitespace checking. She seemed OK with it after that.

Which checks in particular are annoying? I can change the default parameters of JSLint to be less strict about some things. But I don't want to give up syntax checking entirely.


JSLint complained when I had two `var` statements; it wanted me to merge the two into one. I repeat `var`, so this annoyed me. (Of course, it wasn't hard to fix, but the examples didn't show any multi-`var` usage so it may be a problem for someone new to the language or programming in general.)


Use JSHint with

  /*jshint asi:true, eqnull:true, laxbreak: true */
and you'll make everyone happy :)


SPOILERS

I created a successful bothC function that looks more like the simplified version of seqC, calling fC first. But when I switch to calling gC first, I get the following failures. Am I missing something, or is this a bug in the unit test?

  PASSED No JSLint errors
  PASSED bothC(S, S, A, B) === undefined
  PASSED output === "SSA"
  PASSED bothC(S, F, A, B) === undefined
  FAILED output === "SSASFB"
  PASSED bothC(F, S, A, B) === undefined
  FAILED output === "SSASFBFSB"
  PASSED bothC(F, F, A, B) === undefined
  FAILED output === "SSASFBFSBFFB"


I'm not sure that we used the same method to get to this part, but I too ran into this output.

Interested in seeing how my solution was off, and if I was thinking about it the wrong way. Any luck?


Continuation Passing SPOILERS:

f_success = function() { gC(success, failure); }; f_failure = function() { gC(failure, failure); }; fC(f_success, f_failure);

For me, the trick here was to forget about the words "success" and "failure" because they have too much semantics embedded. I had to re-word the problem like this: call f3, if first argument of f1 and f2 are called. All other roads lead to f4. Both f1 and f2 has to be called in the chain no matter what.

Also, this is the first time I've seen such a pattern. Is there a practical application of such pattern? I think it's ok to have a single level of closure to continue execution, but if it goes to that many levels like the sample problem, it'll be a nightmare to maintain for people who have not seen your code yet.


Generally, any check that isn't a syntax exception on commonly used browsers. Specifically, it barfed when I didn't include optional semicolons.

   var x = 5
shouldn't fail.


Do you know a way to disable strict identity over equality checking (=== vs ==)? It's a Crockford-ism, but I think the jury's still out on the value of strict type checking vs coercion and I'd like the choice.



I would love to see how others solved these problems as a reward for completing it on my own.


The only thing that annoys me is two “Expected ';'” errors after e. g.

var f = function () { return 0 }




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: