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

  • SEARCH
  • Home
  • 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 8768513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:05:17+00:00 2026-06-13T17:05:17+00:00

The fat arrow can be used in different settings but it somehow doesn’t always

  • 0

The fat arrow can be used in different settings but it somehow doesn’t
always bind to the instance I want.

  • 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-13T17:05:18+00:00Added an answer on June 13, 2026 at 5:05 pm

    The fat arrow binds at 3 occasions

    1. when declaring a method
    2. when declaring a function within a method
    3. when declaring a function in global context

    1. When declaring a method

    When the Coffeescript compiler encouters the following syntactical pattern
    within a class declaration

    class A
        somemethod: (paramlist) =>
    

    This will yield the following code within the constructor of class A

    this.somemethod = __bind(this.somemethod, this);
    

    That is the definition for that instance is overwriting the initial assignment
    with a bound version of the function

    2. When declaring a function within a method

    When you define a function with a fat arrow within a method the Coffeescript compiler
    automatically creates a closure and and shadows this of the outer method into the variable
    _this. Any reference to @ within the inner function will use the variable _this
    in the generated javascript code

    somemethod: ->
       => @someCall()
    

    And this is the corresponding Javascript

    A.prototype.somemethod = function() {
        //_this references this
        var _this = this;
        return function() {
            //and _this is now used within the inner function
            return _this.someCall();
        };
    };
    

    A definition of a function without the fat arrow doesn’t create that closure for you.

    3. When declaring a function in global context

    If you define a free floating function (meaning as a method in a class and not within another function/method) just like this

    foo = => @bar
    

    Then the corresponding Javascript will look like this

    var foo,
      _this = this;
    
    foo = function() {
        return _this.bar;
    };
    

    The interesting thing here again is that this is being assigned to _this which enables the definition of foo to close over _this.

    The important part however is that this is always the global context of your execution environment. If you are in the browser it will be the window object. If you are running node.js it will be the module you are just running.

    Warning: You shouldn’t define any function accessing your global context anyway. This calls for trouble.

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

Sidebar

Related Questions

I have a FAT filesystem mounted in Linux with the vfat driver. I want
Anyone who can answer my question deserves a BIG FAT GOLD MEDAL OF AWESOMENESS!
What's the difference between colon : and fat arrow => in Ruby? Or when
I am actually trying to extract a Fat Disk Image with DiskUtils but I
We have NTFS, FAT etc for HDD. So I just want to know what
I am getting a fat binary when I go to upload, and I want
I created a fat jar file using JarSplice, but when I launch it i
I can't, for the life of me, work out why there's a fat white
Possible Duplicate: What's the difference between colon “:” and fat arrow “=>” I recently
In a fat arrowed function of a coffeescript class, how can I access the

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.