Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combinatorials #27

Open
NHQ opened this issue Feb 28, 2017 · 6 comments
Open

combinatorials #27

NHQ opened this issue Feb 28, 2017 · 6 comments

Comments

@NHQ
Copy link

NHQ commented Feb 28, 2017

lyk dis:

combo = combine([a,b,c])
comboDelux = combine([combo,e,f,g])
@NHQ
Copy link
Author

NHQ commented Feb 28, 2017

"should be easy"

@dominictarr
Copy link
Collaborator

dude bro don't just slap an issue down like it's a graffitti on a bathroom stall, yo gotta write a poem or short story about why it should be

@NHQ
Copy link
Author

NHQ commented Mar 1, 2017

Uhm, it's like simply showing up to a convention, I've already made my contribution here... where's the snack table?

But all right, give me the mic: I believe the proposed upgrade needs to work through each combination, starting at the top or bottom, not flatly combining all tha deps, so that if you have multiple layers, lyk dis:

combo = combine([a,c,b])
comboPlugin = combine([combo, x, y, z])
comboDelux = combine([comboPlugin, e, f, g])

then your deps will resolve according to the combinations; comboDelux will need the output of comboPlugin, which needs the output from combo. Or maybe it goes the other direction, idk, maybe it can go both ways...

@dominictarr
Copy link
Collaborator

so, for this to work - combine would have to return an object with {gives, needs, create} on it. So then to start the app you'd just call combine([...]).create() and call it empty because you shouldn't have any needs left right? but if a combination of modules is missing a need when you call combine it would return an object with those needs expressed.

would it actually behave differently as long as the order is the same?

combine([a,b,c]) == combine([combine([combine([a]), b]), c]) == combine([a, combine([b, c])])

This would be the same behaviour if combine is just concat

@NHQ
Copy link
Author

NHQ commented Mar 2, 2017

neat, but forcing an order is imho not desirable, in general, but specifically b/c that will make things break awfully if you require a bunch of a features, but don't know which order to concat them (at which point you've truly resurrected script tag madness, tyvm)

But I really must cease my conjectures, until further review, right after this last one:

no... no, I mustn't.

@dominictarr
Copy link
Collaborator

I agree concat was terrible, but depject relives most of the pressure on order, because dependencies (needs) and exports (gives) are explicitly described. If a module does not call anything syncronously in it's create method there won't be problems with order. One pattern is to use setImmediate to delay setup like that. In early versions of depject (before 3) module dependency was resolved and loaded in order, but cycles broke that.

I also worry a bit about ordering. avoiding ordering makes merges easy! but some ordering is hard to avoid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants