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

Fails to compile when subclass constructor calls super #244

Open
olegam opened this issue Sep 20, 2013 · 22 comments
Open

Fails to compile when subclass constructor calls super #244

olegam opened this issue Sep 20, 2013 · 22 comments

Comments

@olegam
Copy link

olegam commented Sep 20, 2013

I can't compile this

class MyTestAbstract
  constructor: ->
    @created_at = new Date()

class MyTestConcrete extends MyTestAbstract
  constructor: ->
 .  super

Seems to be correct syntax but I get:

/usr/local/lib/node_modules/coffee-script-redux/bin/coffee --source-map -i test_class.coffee
Syntax error on line 7, column 9: unexpected '(DEDENT)' (\uEFFE)
4 : 
5 : class MyTestConcrete extends MyTestAbstract
6 :   constructor: ->
7 :     super
^ :~~~~~~~~^

See related question on SO: http://stackoverflow.com/questions/18914349/why-do-i-get-syntax-error-trying-to-call-super

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1742549-fails-to-compile-when-subclass-constructor-calls-super?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github).
@vendethiel
Copy link
Contributor

super's not implemented yet, so yeah.

@olegam
Copy link
Author

olegam commented Sep 20, 2013

Makes sense. Thanks for the great work you are doing. I got started using this based on the recommendation from this blogpost about getting coffee-script to work best with Jetbrains WebStorm: http://blog.jetbrains.com/webide/2013/03/coffeescript-debugging-with-sourcemaps-in-webstorm-6-phpstorm-6/

Is there a schedule for when you will implement features like this?

@vendethiel
Copy link
Contributor

Progress is here.
Roadmap is here.

Also, you should be thanking @michaelficarra, not me (which also means I can't answer your last question).
(and note that the original compiler now includes source maps)

@xixixao
Copy link

xixixao commented Oct 14, 2013

Got here through half a year old question on super in Redux, and after 6 months... :).

I absolutely understand that this project is now left with whatever time anyone willing to help have spare. But could someone explain to me what is the point of a half finished compiler while we have a working compiler? The roadmap now has no due dates. Wouldn't it be better to abandon this project and make sure people like @olegam don't get confused by articles which suggest using redux? Anytime I see "Fixed in redux" tag on the main repo, something moves inside of me. With all due respect to the contributors here...

@michaelficarra
Copy link
Owner

@xixixao: There are some issues with jashkenas/coffee-script that will be incredibly hard to fix because of the compiler's design. The remaining issues here will just take a bit of time to implement. super will probably take me 10-15 hours. Stepped loops can be done in under 4. There's only one issue (splices on LHS of assignment) that has exposed a design flaw in this compiler.

This project is just not as interesting for me right now as some of the other projects I'm working on. I have a lot of really cool stuff coming out soon. I use this compiler pretty much every day and fix bugs immediately as I come upon them. I don't know why many other people aren't motivated to contribute to OSS projects.

@antonkulaga
Copy link

super will probably take me 10-15 hours. Stepped loops can be done in under 4.

How soon are you going to fix it? These two problems are the only things that prevent me (and I suspect a huge number of people like me) from switching to CoffeeScript redux

@michaelficarra
Copy link
Owner

@antonkulaga: I recently negotiated 10% time to work on outstanding OSS issues for Groupon. I'll be prioritising work on CSR, especially these two issues, starting 2014.

@xixixao
Copy link

xixixao commented Dec 30, 2013

@michaelficarra Is there any way to run the CS test suite with Redux (I attempted this, but the internal API is different)? If not, would nice to enable that as well.

@akre54
Copy link

akre54 commented Dec 30, 2013

There are some issues with jashkenas/coffee-script that will be incredibly hard to fix because of the compiler's design.

Not trolling but I've seen you mention this a number of times. Is there an up-to-date list of things that are possible in CSR that aren't possible (or are hard) to fix in jashkenas/coffee-script? The wiki page lists four and the open issues page lists 37, none of which are particularly compelling. What reason would I have to use CSR over CS these days?

@vendethiel
Copy link
Contributor

jashkenas/coffeescript#2342
This is the biggest issue. Other than that, the rewriter is an entangled mess imho.

@notslang
Copy link

duplicate of issue #147

@davidbonnet
Copy link

Still no support of super?

@matthiasg
Copy link

stumbled over this too .. a suggested workaround should at least be presented or documented shouldnt it ?

@jordaaash
Copy link

This issue hasn't been addressed and the project seems to be abandonware. There is no real substitute for super, so the suggested workaround I went with was "don't use CoffeeScriptRedux". Hard to establish any practical use for it when it's not feature complete.

@notslang
Copy link

notslang commented Oct 3, 2014

there's a PR for this over here: #313 ... not sure what's left to do on it

@tangzero
Copy link

try:

class Foo

  constructor: (@name) ->

class Bar extends Foo

  constructor: () ->
    Foo.apply this, ["Peter"]

@jordaaash
Copy link

Only a substitute for super in the simplest case.
Doesn't work with non-constructor methods.

@tangzero
Copy link

Really?

class Foo

  constructor: (@name) ->

  bla: (message) ->
    console.log "#{message} by #{@name}"

class Bar extends Foo

  constructor: () ->
    Foo.apply this, ["Peter"]

  bla: (message) ->
    Foo.prototype.bla.apply this, [message]

new Bar().bla "No super" # No super by Peter 

I don't like the fact that I need to do this way, but works...

@jordaaash
Copy link

You can also do this:

    Foo::bla.apply this, [message]

But that isn't the point. This issue isn't that workarounds to not supporting super don't exist, it's that super doesn't work in CSRedux and it works in CoffeeScript proper, which means CSRedux is not a substitute for the CoffeeScript compiler without changing your code.

@tangzero
Copy link

I agree.

@davidbonnet
Copy link

…or this, which is faster: Foo::bla.call @, message.

Perhaps, the reason why it is called CoffeeScript Redux is that it is missing some of the features… :) Yet omitting super makes the whole class aspect less useful.

@matthiasg
Copy link

Since this specific item seems rather easy to fix.. Are the any other obvious omissions from this compiler ?

-----Original Message-----
From: "David Bonnet" [email protected]
Sent: ‎10.‎10.‎2014 10:40
To: "michaelficarra/CoffeeScriptRedux" [email protected]
Cc: "matthiasg" [email protected]
Subject: Re: [CoffeeScriptRedux] Fails to compile when subclass constructorcalls super (#244)

…or this, which is faster: Foo::bla.call @, message.
Perhaps, the reason why it is called CoffeeScript Redux is that it is missing some of the features… :) Yet omitting super makes the whole class aspect less useful.

Reply to this email directly or view it on GitHub.=

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