Unexpected ( due to generator function?


In atom-python-debugger, I’m writing a function to clear all breakpoints. Breakpoints are stored in an array and in order to clear them all, each must be toggled individually and spliced out of the array. The @toggle function takes care of an individual breakpoint. I came up with the following:

  loopOverBreakpoints: () ->
    n = @breakpoints.length
    for i in [0..n-1]
      yield @breakpoints[0]  # always yield first element; it will be spliced out

  clear: () ->
    for breakpoint from @loopOverBreakpoints()
      @toggle breakpoint

When placed in a script, I can run this code and it performs as expected. However, when placed in my package, Atom complains on activation that there is an “unexpected (” on the for ... from line. The error isn’t elsewhere in the code because commenting out the for ... from loop makes Atom happy.

Any idea what that might be due to?


@dpo Atom only just merged a PR adding Coffeescript 1.12 support, which is the version that added for...from syntax. I believe you’ll need to be using Atom 1.23-beta0 or higher for your code to transpile correctly.


Thanks for the info. I downloaded Atom beta but it crashes on startup and causes an error message to pop up in Atom stable: “Failed to load config.cson: table overflow”. Guess I’ll try another time.


Talk about messing everything up. Now Atom stable doesn’t run properly anymore. Starting it up results in a situation like this:

Atom beta won’t start but it lived long enough to screw things up. Not sure it’s a great idea to have it share the packages folder with stable.