Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iced3: Can't reference "@s" as "s" in code like constructor : (@s) -> #202

Open
zapu opened this issue Jun 26, 2017 · 2 comments
Open

iced3: Can't reference "@s" as "s" in code like constructor : (@s) -> #202

zapu opened this issue Jun 26, 2017 · 2 comments

Comments

@zapu
Copy link
Collaborator

zapu commented Jun 26, 2017

michal@miso ~/iced_work » cat -n at_name.iced
     1	class Test
     2	    constructor : (@s) ->
     3	        console.log "s is ", s
     4	        console.log "@s is ", @s
     5	        console.log "@ is ", @
     6	
     7	new Test "hello world"
michal@miso ~/iced_work » iced at_name.iced
s is  hello world
@s is  hello world
@ is  Test { s: 'hello world' }
michal@miso ~/iced_work » iced3 at_name.iced
ReferenceError: s is not defined
  at new Test (/home/michal/iced_work/at_name.iced:3:30)
  at Object.<anonymous> (/home/michal/iced_work/at_name.iced:7:5)
  at Object.<anonymous> (/home/michal/iced_work/at_name.iced:1:1)
  at Module._compile (module.js:570:32)

Generated code has changed from: (on iced2):

function Test(s) {
      this.s = s;
      console.log("s is ", s);
      console.log("@s is ", this.s);
      console.log("@ is ", this);
    }

to (iced3):

function Test(s1) {
      this.s = s1;
      console.log("s is ", s);
      console.log("@s is ", this.s);
      console.log("@ is ", this);
    }
@maxtaco
Copy link
Owner

maxtaco commented Jun 26, 2017

didn't even know you can do that.

@zapu
Copy link
Collaborator Author

zapu commented Jun 26, 2017

me neither, looks like it's only working by accident in iced2 (and coffee as well?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants