funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
niwinz 2016-11-04T07:49:00.000189Z

@adamfrey many of the cats facilities for work with promises is already in a separated library: funcool/promesa, and the latest version inclused support for other thenables than bluebird, so probably you can use it with jquery promise abstraction

adamfrey 2016-11-04T13:11:23.000190Z

I’ve been in the Promesa library code, but I didn’t realize that there was support for other promise types. Added 2 days ago at that. just in time! Thanks!

adamfrey 2016-11-04T13:34:02.000191Z

@niwinz With the new version of Promesa I can use promesa.core/then with a jQuery deferred object just like you said. But when I try to use one in a cats.core/alet macro, I get a “No context is set…" error

niwinz 2016-11-04T13:35:25.000192Z

sure

niwinz 2016-11-04T13:35:55.000195Z

you should extend the jquery deferred type

niwinz 2016-11-04T13:36:21.000196Z

with some cats related protocols in the same way as we do it with bluebird promise object

adamfrey 2016-11-04T13:38:04.000197Z

ok, that’s what I originally thought. But I was mistaken just now in thinking that cats would recognize a jQuery deferred object as some sort of generic promise. Thanks for your help

niwinz 2016-11-04T14:06:40.000198Z

there are no magic, cats works with types and protocols if some type does not implements its protocols, it will not work with them

martinklepsch 2016-11-04T14:16:39.000199Z

I think opening Promesa to other promise implementations is really cool, I played with wrapping Closure :closurelib: promises but didn't get very far. Are you aware of implementations other than the default one based on Bluebird using the promesa protocols? @niwinz

niwinz 2016-11-04T14:19:53.000201Z

@martinklepsch I'm not aware of

niwinz 2016-11-04T14:21:23.000202Z

the latest version of promesa supports the usage of other promise types with promesa abstractions

niwinz 2016-11-04T14:21:48.000203Z

in fact, it support anything "thenable" in promises vocabulary

niwinz 2016-11-04T14:22:23.000204Z

My main concern in replacing bluebird promise is the perfomance and the introspection

niwinz 2016-11-04T14:22:39.000205Z

among the debugging stuff such that long stack traces that bluebird has...

martinklepsch 2016-11-04T14:28:27.000207Z

Yeah, I'm by no means suggesting bluebird should be replaced, I'm sure there are good reasons that Promesa is build on top of it 🙂 I just think it'd be nice to also have a version of the library that does 80% without the bluebird dependency (using goog.Promise which is probably included in your build anyways).

niwinz 2016-11-04T14:30:34.000208Z

hmm is not bad idea but I don't know how we can do it in one unique library

martinklepsch 2016-11-04T14:53:08.000209Z

doesn't have to be the same lib, could be promesa-closure or whatever which depends on promesa but excludes the bluebird dep or similar

martinklepsch 2016-11-04T14:53:59.000210Z

Either way I think this is fine for other people to do that want it (like me) and probably not something you should officially support/implement

martinklepsch 2016-11-04T14:55:03.000211Z

I'd just like to have some kind of reference impl that I can use as a base/helps me understand what exactly needs to be done, but maybe @adamfrey makes something on the jQuery promise stuff and that will be just fine 🙂

niwinz 2016-11-04T14:59:20.000212Z

I agree with you

niwinz 2016-11-04T14:59:41.000213Z

but in some manner I want to have a more lightweight impl for promesa

niwinz 2016-11-04T15:00:28.000214Z

bluebird is good in one aspect but no so good in other

niwinz 2016-11-04T15:00:32.000215Z

the size of the library