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

New syntax for stamps as Babel plugin #80

Open
koresar opened this issue May 27, 2015 · 8 comments
Open

New syntax for stamps as Babel plugin #80

koresar opened this issue May 27, 2015 · 8 comments

Comments

@koresar
Copy link
Member

koresar commented May 27, 2015

I believe stamps are much better approach to OOP. In fact, I call classical OOP as BOP (Blueprint Oriented Programming).

Stamps can, should, and must be inbuilt into programming languages. Imagine you could write this in JS:

let StampA = stamp {
  myMethod() {},
  myState: "a state",
  static staticVar: "static var",
  init({instance, stamp, args}) { ... }
}
let StampB = stamp {
  static staticMethod() {}
}
let StampC = StampA.compose(StampB).props({ X: "y" });

var instance = StampC({X: "x"})

I haven't thought about syntax much (I haven't thought about it at all actually).

Do you get the idea? Do you feel it? Do you agree we can turn the programming world upside down?

@troutowicz
Copy link
Member

import stampit from 'stampit';

Object.prototype.stampit = stampit;
Object.prototype.isStamp = stampit.isStamp;

let StampA = {
  myMethod() {},
  myState: "a state",
  static staticVar: "static var",
  init({instance, stamp, args}) { ... }
}.stampit();

let StampB = {
  static staticMethod() {}
}.stampit();

let StampC = StampA.compose(StampB).props({ X: "y" });

Object.prototype.isStamp.call(StampC);

\o/ This feels hot.

@koresar
Copy link
Member Author

koresar commented May 27, 2015

Polluting Object prototype? :) Maybe next time.

@troutowicz
Copy link
Member

You wanted stampit built into the language... stamps are objects. :)

@koresar
Copy link
Member Author

koresar commented May 27, 2015

Exactly. Stamps are object. Arrays are objects. Going further, classes in Java/C# are also objects of a special kind. Why stamps can't be one of them? :)

@ericelliott
Copy link
Contributor

Haha, cool idea, but this is out of scope for this repository. Maybe create a separate one for a Babel plugin? =)

BTW, while I think native support would be great, I'll probably continue to use stampit as a library until there is a real effort to standardize it in the language.

In order to gain support for language standardization, we need to get closer to 20k stars for Stampit, so spread the word. ;)

@koresar
Copy link
Member Author

koresar commented May 28, 2015

Having stampit, react-stampit, supermixer and, hopfuly, babel-stampit someday we should consider moving all that to an organization: github.com/stampit.

@troutowicz
Copy link
Member

👍

@ericelliott
Copy link
Contributor

I'm cool with an org, but somebody else already has the "stampit" username but I just grabbed "stampit-org".

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

3 participants