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 8061757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:26:42+00:00 2026-06-05T10:26:42+00:00

I have read several papers on CoffeeScript OOP. From them, do I understand correctly

  • 0

I have read several papers on CoffeeScript OOP. From them, do I understand correctly that using the @ sign in CoffeeScript (and this prefix in JavaScript):

  • for variables: makes variables members of a class instance. Each instance has it’s own such variable (non-static variable)
  • for “methods”: makes methods static, which is contrary to what it does with variables

I am a noob in JS and CS, sorry. Their philosophy is quite different from what I am used to.

UPDATE

Here are references on the info that I have read:

  • reference-1
  • reference-2

just search for static.

  • 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-05T10:26:44+00:00Added an answer on June 5, 2026 at 10:26 am

    Inside a method, @ is JavaScript’s this and refers to the current object; the current object depends on how the method is called, see call and apply for ways to mess around with a method’s @ (AKA this); you can also use => to bind a method to an object in CoffeeScript.

    If you say @p = 11, that’s the same as this.p = 11 and makes p available in that object.

    Inside a class definition, @ refers to the class itself. So this:

    class C
        @m: -> ...
    

    defines a class method and you can say C.m() to execute it.

    Consider this example:

    class C
        a: -> @p = 11
        b: -> console.log(@p)
        @c: -> console.log('Class method')
    
    C.c()            // This calls the class method.
    o = new C
    o.b()            // There is no 'o.p' yet.
    o.a()            // This sets 'o.p'.
    o.b()            // And now we see an 'o.p'.
    console.log(o.p) // And we see o.p here as well.
    

    That will give you this output in the console:

    Class method
    undefined
    11
    11
    

    Demo: http://jsfiddle.net/ambiguous/DFcRt/

    These might also be of interest:

    • Variable types in CoffeeScript
    • How to make method private and inherit it in Coffeescript?
      ​
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I must say that I have read several post about this at StackOverflow
I have read several times that using catch (Exception ex) { Logger.LogError(ex); } without
I have read several posts already. And almost everyone suggest using QuartzCore/QuartzCore.h with layer.cornerRadius
I have read several questions regarding this but I fear they may be out
I have read in several places that it's possible to share the objects directory
I do not fully understand classes. I have read the python documentation and several
Please read the entire question. I have a unique situation with several constraints that
I have read several topics (like this one: Database field containing HTML display raw
I have read several tutorials, but I just can't this to work. My apache
I have have read several entries regarding dropping several functional functions from future python,

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.