Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8425993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:25:38+00:00 2026-06-10T04:25:38+00:00

CoffeeScript Source return sprite: myFunc width: 79 height: 66 throw: from: {} last: {}

  • 0

CoffeeScript Source

return sprite: myFunc
  width: 79
  height: 66
throw:
  from: {}
  last: {}

Compiled With CoffeeScript 1.1.1

return {
  sprite: myFunc({
    width: 79,
    height: 66
  }),
  "throw": {
    from: {},
    last: {}
  }
};

Compiled With CoffeeScript 1.3.3

return {
  sprite: myFunc({
    width: 79,
    height: 66
  })
};

({
  "throw": {
    from: {},
    last: {}
  }
});

This breaks my code. I can see nothing in the changelog between versions. Is this a bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:25:40+00:00Added an answer on June 10, 2026 at 4:25 am

    I’d call it a bug but the bug was in 1.1.1 and in your code for depending on a particular interpretation of ambiguous code. This:

    return sprite: myFunc
      width: 79
      height: 66
    throw:
      from: {}
      last: {}
    

    may be a little ambiguous as to what block throw is supposed to be in but the 1.3.3 interpretation is the only one that makes sense to me: your indentation doesn’t match your intent.

    If we add a function wrapper for clarity:

    f = ->
      return sprite: myFunc
        width: 79
        height: 66
      throw:
        from: {}
        last: {}
    

    then what little ambiguity was there vanishes and the 1.3.3 interpretation:

    f = ->
      return { sprite: myFunc(width: 79, height: 66) }
      { throw: { from: {}, last: {} } }
    

    makes perfect sense as your structure is just a variation on:

    f = ->
      return pancakes
      eggs
    

    Just because braces and parentheses and what not are optional doesn’t mean that they are forbidden. If the intent of a piece of code structure isn’t obvious at a glance then you should force the structure with some braces and parentheses, something like this perhaps:

    return { sprite: myFunc
      width: 79
      height: 66
    throw:
      from: {}
      last: {}
    }
    

    or better (IMO):

    return {
      sprite: myFunc(
        width: 79
        height: 66
      )
      throw:
        from: {}
        last: {}
    }
    

    Unfortunately, you’re going to have to read all your CoffeeScript and add braces as needed. I hope you have a very good test suite.


    Interestingly enough, if you drop the return:

    sprite: myFunc
      width: 79
      height: 66
    throw:
      from: {}
      last: {}
    

    then you get this interpretation in the latest:

    {
      sprite: myFunc(...)
      throw:  { from: ... }
    }
    

    That makes perfect sense to me as it looks like:

    v =
      sprite: myFunc ...
      throw: ...
    

    Your explicit return introduces context that isn’t present when the return is implied.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert a function from Javascript to CoffeeScript. This is the code:
In coffeescript we can do this way: rows = [ {a: 1} {b: 2}
I'm using this coffeescript code: in a spec file: index = new MeetingIndex(render: false,
I am building couchdb from source using: https://github.com/iriscouch/build-couchdb/ How do I enable coffeescript as
given this coffeescript data = Foo: B Foos: [ A, B ] Blah: Id:
I have the following CoffeeScript code: class Person secret = 0 constructor: (@name, @age,
I'm working on upgrading a library that looks something like this (in coffeescript for
Given that: The asset pipeline is fairly complex (coming from ASP.NET MVC, this is
I'm just asking this out of curiosity : Is there any tool that can
How do you use CoffeeScript? It need to be compiled, so - you write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.