sighjs / sigh

multi-process expressive build system for the web and node.js, built using baconjs observables
209 stars 12 forks source link

Implement `collectInitials` option for `merge`. #46

Closed insidewhy closed 8 years ago

insidewhy commented 8 years ago

It will operate like https://github.com/Strate/sigh-await-and-merge

Strate commented 8 years ago

Related thing: filter plugin emits Bacon.nothing() when array is empty, which gonna to be a problem with awaiting: if all events are filtered out on initial build phase, awaiting will never gonna end.

insidewhy commented 8 years ago

That's a sigil and is flattened out.

Strate commented 8 years ago

Emitting empty array could be a solution.

insidewhy commented 8 years ago

You don't understand: https://github.com/baconjs/bacon.js/#observable-flatmap

Strate commented 8 years ago

I can not understand why do you point me to that documentation section, but change line from return events.length === 0 ? Bacon.never() : events to return events does the job.

insidewhy commented 8 years ago

That piece of documentation explains it. If you can't even understand that then I have to question why you think you're informed enough to give me "advice" (which is all incorrect) on how to fix this.

It comes across as horribly arrogant. First do the research, then learn how to actually use the programming technique and APIs, and then you are qualified to give your opinion. Until then you're wasting everybody's time.

insidewhy commented 8 years ago

That code is designed to only pass along the empty array in the case it is passed an empty array. If it filters a non-empty array to nothing then the event is hidden. It's clear that it's how it's designed to work if you understand bacon.js, flatMap exists to flatten event streams. As I said Bacon.never() is a sigil, it is never passed along.

Strate commented 8 years ago

I do understood that, thank you sir. Do you close this issue because you won't to implement this thing?

insidewhy commented 8 years ago

I just finished implementing it, will push soon!

Strate commented 8 years ago

One more thing. Why do you consider to hide event, instead of keeping it empty if it filtered out completely? Performance reasons?

insidewhy commented 8 years ago

At the moment generally [] is used as an initialisation event (all streams receive it as the first event). It shouldn't hurt to just pass it down by itself though.

insidewhy commented 8 years ago

First attempt in this commit: https://github.com/sighjs/sigh/commit/58f34318434e9c69e31b7665a234dbd871038e26

Haven't tested it yet.

insidewhy commented 8 years ago

There it works now, is used as part of sigh's own build process.