jashkenas / jashkenas/coffeescript

Proposal: allow super in object literals

Open
#5,075 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

[As seen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super#Using_super.prop_in_object_literals).
```coffee
obj1 = ->
method1: ->
console.log 'method1'

obj2 =
method2: ->
super.method1()

Object.setPrototypeOf obj2, obj1
obj2.method2() # logs "method1"
```

The `obj2` variable would transpile to:
```js
obj2 = {
method2() {
super.method1();
}
};
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the MDN reference and the CoffeeScript examples in the issue as the starting point, then inspect how object literals and existing super syntax are compiled. The work is done when the example compiles to an object method using super.method1() and the resulting call behaves as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, javascript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.