canjs / can-observe

Observable objects
https://canjs.com/doc/can-observe.html
MIT License
20 stars 2 forks source link

rename decorators: async -> getAsync, resolver -> resolvedBy (fixes #52) #63

Closed christopherjbaker closed 4 years ago

christopherjbaker commented 6 years ago

Both of the originals were left in and deprecated

I changed async because its present form cannot be imported as a named import, due to the new-ish async functions. I have no connection to getAsync, I just figured this was a good time to change it as we were changing the other.

justinbmeyer commented 6 years ago

Ah, I missed the part where you left them in. Lets brainstorm a bit on these names. One problem with resolveBy and getAsync is they both are really resolved by calling resolve. Why aren't they both called resolveBy? The difference is that:

@chasenlehara and @phillipskevin should be involved in this because can-value will likely have these methods too, we should try to be consistent everywhere. Relevant issue:

https://github.com/canjs/can-value/issues/5

Some options:

Best might be:

value.returnedBy()
value.resolveAsync()
value.resolvedBy()

idk ... I'm very open to suggestions ...

Another:

value.compute( handler() )
value.asyncCompute( handler(resolve) )
value.resolve( handler( {listenTo, lastSet, resolve, stopListening} ) )
chasenlehara commented 6 years ago

I don’t feel strongly about this, but I would lean toward what Justin’s proposing, with the exception that I would call it either resolvedByAsync or resolvedAsync.

BigAB commented 6 years ago

Is this accurate:

basic getter: is analogous to a synchronous get async getter: is analogous to an asynchronous get, like 1 promise, 1 value to return binder: is analogous to a stream, from 1 dependancy change could produce 0 - many values

If this is accurate I like: