Comments (7)
Hmm, it depends on how you are using reduce
- I figure in reduce, the default (in core) goes first and then the customization gets called after - to wrap the default value. so using that way, we'd want the most specific to run last, and the least specific to run first. I guess we could just add reduce-right
though?
however, I feel we don't really have great data on using reduce yet.
from depject.
Which was @clehner's idea. I guess it's not hard to just do it in that order, maybe we should just make the documentation clear about that.
from depject.
whatever order we choose, i think we will want reduce
to match right? as in i think it would be better (haven't yet hit a real-world use case for overriding my reduce-able configuration) for reduce functions to first call core, then userland, then customizations last.
from depject.
I think the existing order is good.
I like that at the moment apply.js is just sugar over Array.prototype.find (though I see you avoid that in favor of imperative syntax, presumably to cater to older JS implementations), Array.prototype.map, Array.prototype.reduce - it would be a drastic breaking change and if you're going to do a breaking change I'd personally like to see first
be renamed find
rather than changing the directionality but really don't care that much.
The current order of reduce
also aligns with the directionality of Object.assign
You can emulate different directionalities pretty easily already, just by reversing the input, or you can not reverse them and still emulate last
by abusing reduce
from depject.
i keep running into a problem in catstack
(a full-stack framework using depject
) where i want the developer to be able to override any framework module, so put the user's modules first, but then that means some helper modules used to create plugs aren't available within create
. i've been working around it so far, but have seriously thought about adding a "priority" to modules to determine what runs first, second, etc, but switching the order should also work for the reasons in the original post.
from depject.
I fear that priority might be necessary (other similar systems have it sometimes) but I'd sooner make a breaking change to the ordering. @ahdinosaur I think changing the ordering would give you what you are looking for. you can override modules, and you'll have the general modules initialized before the specific.
from depject.
so i forgot about this issue and implemented priority: https://github.com/depject/depject-priority. but i think i still want to reverse the order.
from depject.
Related Issues (19)
- idea: depject image manipulation app based around canvas HOT 4
- module terminology HOT 2
- overriding give/needs on a specific module
- idea: depject app as script tags HOT 4
- gives and needs sugar HOT 7
- better error message for when needs: true
- [apply] super / extend / around HOT 3
- has anyone used reduce yet? HOT 12
- [apply] be able to pass in custom apply function HOT 8
- combinatorials HOT 6
- better error message when created plug is not a function HOT 1
- dynamic modules HOT 8
- A needed module that returns a number returns undefined if the number is zero HOT 1
- Using reduce for decorators HOT 11
- module path override is undocumented HOT 8
- a silly idea: frameworks and plug paths as files paths
- examples make no sense HOT 1
- asynchronous create functions? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from depject.