Hacker Newsnew | past | comments | ask | show | jobs | submit | satyr's commentslogin

Try:

    switch a
      when b
         , c
         , d
        e()


The inconsistency doesn't stop there; `for` variables are specialcased:

    bar = ->
      alert "Holy crap cheese is awesome!"

    foo = ->
      for bar of bars
        console.log bar
      return

    var bar, foo;

    bar = function() {
      return alert("Holy crap cheese is awesome!");
    };

    foo = function() {
      var bar;
      for (bar in bars) {
        console.log(bar);
      }
    };


That makes plenty of sense to me; when do you ever want to leak a for loop counter to an outer scope?


And when do you ever want to leak local variables to an outer scope? Never.

Not to mention that loop counters are no different than other `var`iables in JS.


You do want to sometimes reference outer scope variables from inner scopes, though. The only difference between a leaked local and a properly referenced global is usage semantics.


> I suggest it's an error.

So we'd have to give up:

    array
    .map (x) ->
      f x
    .reduce (a, b) ->
      g a, b


There's no outdented continued call in current CoffeeScript; an outdented line always makes OUTDENT.

(Or are you suggesting to allow such code? I personally see no value in it.)


I believe you mean:

    foo
      bar;
      bash: something;
      thenBlitz.
http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap3.html...


yes I do!


  # Fix things CS goofs.
  # Add things CS lacks.


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

Search: