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

First Class Protocols: Stage 1 #31

Open
hzoo opened this issue Sep 28, 2017 · 1 comment
Open

First Class Protocols: Stage 1 #31

hzoo opened this issue Sep 28, 2017 · 1 comment

Comments

@hzoo
Copy link
Member

hzoo commented Sep 28, 2017

Champion: @michaelficarra
Repo: https://github.com/michaelficarra/proposal-first-class-protocols
Slides: https://docs.google.com/presentation/d/1WrvSyslnF-5VnPj3k3HRq8MRzuiSN1kQ6ENE1iUSmDU/edit?usp=sharing
First presented at the Sept 2017 meeting

Example

protocol ProtocolName {
  // declare a symbol which must be implemented
  thisMustBeImplemented;

  // and some methods that you get for free by implementing this protocol
  youGetThisMethodForFree(...parameters) {
      methodBody;
  }
}

class ClassName implements ProtocolName {
  [ProtocolName.thisMustBeImplemented]() {
    // this is the implementation for this class
  }
}

let instance = new ClassName;
instance[ProtocolName.youGetThisMethodForFree]();

Implementation

@hzoo hzoo mentioned this issue Sep 28, 2017
11 tasks
@littledan
Copy link

I'm excited to see more feedback on this proposal through Babel!

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

No branches or pull requests

2 participants