jashkenas / jashkenas/coffeescript
Proposal: allow super in object literals
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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