CC-Archived / promise-as3

Promises/A+ compliant implementation in ActionScript 3.0
168 stars 55 forks source link

Consider renaming `Promise.when` to `Promise.adapt` #16

Closed darscan closed 11 years ago

darscan commented 11 years ago

This is pretty minor, and just a thought really, but when doesn't sound like an adapter to me. When sounds very much like any/all.

In a closed-source implementation that I wrote for someone, I used When as a class to house: When.all(), When.any() etc

johnyanarella commented 11 years ago

I was just following in the trail of Q.js and when.js, which expose when() as their adapter method. Their authors are leading the charge on the Promise/A+ specification, so I thought it best to match existing conventions.

In promise-as3, we have expanded the scope of what when() would normally do to include adapting other kinds of asynchronous operation tokens (not just values, Promises, and untrusted third-party Promises). For the AsyncToken case, it seemed a natural fit to make this method more powerful rather than introducing a new method. Even now, I'm not sure if I want to expand the syntactical noise by distinguishing this capability explicitly as adaptation.

Nice! I like the readability of When.all(), When.any(). For Deft JS, I went with Promise.all(), Promise.reduce and had been thinking of doing the same here. I could see going either way on this for #4 or #5.

Thanks for the suggestion!

darscan commented 11 years ago

I was just following in the trail of Q.js and when.js, which expose when() as their adapter method. Their authors are leading the charge on the Promise/A+ specification, so I thought it best to match existing conventions.

Agreed!

Even now, I'm not sure if I want to expand the syntactical noise by distinguishing this capability explicitly as adaptation.

Fair point.