Closed koresar closed 6 years ago
In couple of weeks, if no objections, I'd add the change to spec.
I gave it a second thought. The feature would better fit the stampit module rather than the specification. Here is the function to put it in: https://github.com/stampit-org/stamp/blob/00020b55b1e679da3aafcc67aaf60f6d1b3897fc/packages/it/index.js#L15
I'm using the stamps extensively. Most of my stamps are named using this utility stamp - https://www.npmjs.com/package/@stamp/named I would like to stop importing that module and just make the
Stamp.name
a built-in feature.Another reason to add "name" support are classes. Classic OOP classes have names. Stamps are all anonymous.
One more reason why name built in support is so important - I want to make a proposal to (any) program language to support stamps natively instead of freaking classes. Like so:
In the example above the
MyStamp
would become the stamp's name. (In Javascript it's MyStamp.name.)Proposed changes to the specification:
const DerivedStamp = Stamp.compose(); console.log( DerivedStamp.name ); // still "MyName" console.log( DerivedStamp.compose.staticPropertyDescriptors.name.value ); // still "MyName"