-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
syntax error #43
Comments
These issues are both known. The first issue is that I simply haven't yet added support for block comments, since they provide no functionality, and are an extremely low priority for me right now. Just replace them with single-line comments, which are ignored. I'll get to them when other real problems have been taken care of. The second issue is one I'm currently debating over how to solve, so I'm glad you've brought it up publicly. Really, you shouldn't be allowed to perform an assignment within a higher-precedence operation like a |
I guess it could be I was really hoping redux would be backwards compatible. I've got around 40,000 lines of coffescript and it would be nice if I didn't have to support 1.x and 2.x at the same time for different projects. But that is my selfishness. Do what is right for the community. |
Now that I think about it, if I had to use
which is less expressive than the old way. Couldn't you just make |
Nice discussion. I would tend towards allowing things like In the case of do drawTree = (tree = root, depth = 0) ->
return unless tree
drawValue tree.value, depth
drawTree tree.left, depth + 1
drawTree tree.right, depth + 1 About the mixed Also, i sometimes find things like Finally, notice that the argument about how |
That's the goal, but the compatibility is with the CoffeeScript features as we intended them to be implemented. For instance, I didn't duplicate any of the bugs in the current compiler, so it's no backwards compatible in that way. But that was always the goal. I'm just not sure if we ever intended to allow people to throw unqualified assignment operations into just about everything.
Remember: this wouldn't be disallowed, you would just need to raise the precedence of the assignment by putting it in parentheses. |
Exactly. Here is the code that gave the error, minus a bunch of snipping. Note the nesting and how messy it would be if
@michaelficarra Please don't take this away from me. I really like @epidemian's idea of changing the precedence of = when the left side isn't legal. Coffescript is very pragmatic. Making it less useful for the sake of syntactic "purity" would be a big loss to the language. |
@mark-hahn Cool. Yeah, though i've never used them, i think recursive functions are a valid use of
Yeah, but is it necessary? Does In my previous comment i said that the only requirement was that the LHS of My point is that I don't know if it's a good example but, in Ruby Anyway, that's just my opinion, i'm also interested in knowing what @jashkenas thinks. |
Hrm. I don't know about the "correct operator precedence"-ness of it all, but I think it's highly desirable to have:
... work like this:
... even though they're just longhand versions of |
I use auto-invoking functions with |
Just wondering, isn't do (reuse = ->
scope = 'I have new scope'
) and: (reuse = ->
scope = 'I have new scope'
)() equivalent to: reuse = ->
scope = 'I have new scope'
reuse() |
@glitchmr: yes |
The use case of @jashkenas is different from that of @epidemian. For "default value assignment" that @jashkenas mentioned, I would favor the shorthand However, @epidemian mentioned a valid use case, in that one intends to work with various different variables. For example: if foo && bar = funcThatReturnsSomething()
# do something with bar This is, almost certainly, an upgrade from bar = funcThatReturnsSomething()
if foo && bar
# do something with bar I think that, if coffeescript aims to be a wrapper script that provides convenience and irons out inconveniences of javascript, then I think this being a useful shorthand should already be a valid argument. Symmetry (hence predictability) would also be a concern. On one hand, we have the already implemented On the other hand, |
I'm trying redux for the first time on production code that works in cs 1.3.3. Here are the first two syntax errors before I gave up ...
The text was updated successfully, but these errors were encountered: