Giter Club home page Giter Club logo

Comments (6)

jashkenas avatar jashkenas commented on August 26, 2024

It should compile to the first case if we add it.

You prefer this style because the parenthesis doesn't need to wrap, right? It wouldn't be too hard to add to the grammar, but I think it could look a little funky on a single line, or for methods that don't take prior arguments. You're proposing:

list.each() x => x * x.

Versus the current compiler's:

list.each(x => x * x.)

Do you have any real examples where it helps make things clearer?

from coffeescript.

liamoc avatar liamoc commented on August 26, 2024

Partly i like it because it eliminates the need for specifying the end of a block twice. Typing ".)" is really awkward in my opinion, when I want to be able to define my own control structures.

Also, it drastically simplifies providing multi-line functions as parameters when you throw significant indentation into the mix.

from coffeescript.

jashkenas avatar jashkenas commented on August 26, 2024

It would be cool if CoffeeScript's lexer were smart enough to insert a period into the token stream for you, when you had an unclosed block within an outer parentheses. This may be do-able by counting parentheses. So:

list.each(x => x * x)

from coffeescript.

liamoc avatar liamoc commented on August 26, 2024

That would be nice, but significant indentation would also remove that problem.

from coffeescript.

liamoc avatar liamoc commented on August 26, 2024

My problem then is that I'm still specifying the end of the block twice - both with a paren and a dedent, or a paren and a period.. I'd rather get rid of the parens, but I guess it's just a pet peeve of mine.

from coffeescript.

jashkenas avatar jashkenas commented on August 26, 2024

Sorry, the block syntax is just too limited -- mentioned in the other issue. No multiple function arguments, and it has to be the last one. It wouldn't always be possible to call to with JS libraries with if they expected either. Closing as a "wontfix".

from coffeescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.