stampit-org / stamp-specification

The Stamp Specification: Composables
434 stars 16 forks source link

Support getters/setter inside any metadata (props, methods, deepThings...) #128

Closed koresar closed 5 years ago

koresar commented 5 years ago

Closes #125 #127 (and few other issues throughout the years).

koresar commented 5 years ago

@FredyC hey, do you want to take a look? :)

Hey, @lornally , it's happening :)

koresar commented 5 years ago

This PR will be merged by me in 2-3 days if everyone is fine with it. :)

danielkcz commented 5 years ago

@koresar Sorry, don't wait for me, my interest in stamps is kinda gone for last year or so. I don't use them anywhere anymore. I just couldn't get over the missing TypeScript support :)

koresar commented 5 years ago

I wish I knew how to support TypeScript.

But this project needs someone sane, someone like you to review all my crazy ideas. Can you be that person?

danielkcz commented 5 years ago

I would love to help, but having stamps in my hands a year ago I don't really know what you are trying to achieve here anymore :)

koresar commented 5 years ago

I just want getters and setters to be the first class citizens. Like functions.

On Thu., 27 Jun. 2019, 17:15 Daniel K., notifications@github.com wrote:

I would love to help, but having stamps in my hands a year ago I don't really know what you are trying to achieve here anymore :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stampit-org/stamp-specification/pull/128?email_source=notifications&email_token=AAMMEL3EIWMOFBHVMQHIBEDP4RSK5A5CNFSM4H2UYVS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYWFZKI#issuecomment-506223785, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMMEL7BXM3TQDJU7RXY5H3P4RSK5ANCNFSM4H2UYVSQ .

danielkcz commented 5 years ago

Ok, I said it in a wrong way. Not that I wouldn't understand exactly what you mean here, but it's just hard to imagine any implications coming from it. Even after seeing the PR you just linked, I am like "whaaat? it doesn't make sense to me anymore".

Sorry.

lornally commented 5 years ago

i think less is better, maybe less effect is right for a framework, so i support this. and maybe we can try to support typescript and coffeescript.

lornally commented 5 years ago

and I think, the props and methods are sugar only, we need not limit it, we can free use the keys, and we use it more reasonable, just because it is specificate, not because we can't use it more freely. my English is poor enough, so maybe I can not explain what I mean. sorry:)

koresar commented 5 years ago

I think I understand what you mean. We do not limit "methods" to bytes functions. Anything can go there.

On Fri., 5 Jul. 2019, 18:20 茂弘, notifications@github.com wrote:

and I think, the props and methods are sugar only, we need not limit it, we can free use the keys, and we use it more reasonable, just because it is specificate, not because we can't use it more freely. my English is poor enough, so maybe I can not explain what I mean. sorry:)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stampit-org/stamp-specification/pull/128?email_source=notifications&email_token=AAMMELY3HIUTI67YU5FFTG3P5375JA5CNFSM4H2UYVS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZI4JPA#issuecomment-508675260, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMMELYWVE7WOFGJAT5F6QLP5375JANCNFSM4H2UYVSQ .

lornally commented 5 years ago

yes, that is what i mean, and, I think props is same with methods. so we can build methods in props, but we are not suggest to do that.

koresar commented 5 years ago

Correct.

Props are per instance, each copied by reference every time an object is created.

Whereas methods are per stamp. Objects created from that stamp will have the "methods" object as its prototype.

On Fri., 5 Jul. 2019, 21:49 茂弘, notifications@github.com wrote:

yes, that is what i mean, and, I think props is same with methods. so we can build methods in props, but we are not suggest to do that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stampit-org/stamp-specification/pull/128?email_source=notifications&email_token=AAMMEL2VL7A5XPV2CZIK4ALP54YOJA5CNFSM4H2UYVS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJKQUY#issuecomment-508733523, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMMEL2ZAQQAJBQN43MTYXDP54YOJANCNFSM4H2UYVSQ .

lornally commented 5 years ago

yes, you are right, that my mistake, props is different with methods, so we need make the getter/setter in methods? or maybe we can let user choice which place they want to use, they can do it in method or props, so get the different effect?

koresar commented 5 years ago

I believe getters/setters should be no different from regular object properties. Thus all the stamp elements must support them. - props, methods, statics, deepProps, conf, deepConf, etc.