Giter Club home page Giter Club logo

Comments (7)

dominictarr avatar dominictarr commented on June 15, 2024 1

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.

dominictarr avatar dominictarr commented on June 15, 2024

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.

ahdinosaur avatar ahdinosaur commented on June 15, 2024

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.

nrkn avatar nrkn commented on June 15, 2024

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.

ahdinosaur avatar ahdinosaur commented on June 15, 2024

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.

dominictarr avatar dominictarr commented on June 15, 2024

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.

ahdinosaur avatar ahdinosaur commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.