Giter VIP home page Giter VIP logo

Comments (5)

edemaine avatar edemaine commented on September 8, 2024 1

The best polyfill I've found is https://github.com/MadProbe/iterator-helpers-polyfill
It's a bit out-of-date in the async side (see issue 15), but hopefully good enough for your purposes...

I'm not sure we want to redefine [...asyncThing] (though I see Array.fromAsync is backward-compatible in the sense that it supports regular iterators), but perhaps new notation like [...*asyncThing] could trigger this? Ideally we could also support [a, ...*b, ...c, ...*d] via something like [a, ...Array.fromAsync(b), ...c, ...Array.fromAsync(d)] (unless we can think up a more efficient compilation).

from civet.

bbrk24 avatar bbrk24 commented on September 8, 2024 1

Array::concat can handle multiple arguments, and is way faster than multiple spreads: JSBenchmark .concat is about 5x faster for me (Firefox on Windows). So, the compilation would be [a].concat(Array.fromAsync(b), c, Array.fromAsync(d)).

from civet.

bbrk24 avatar bbrk24 commented on September 8, 2024

I wouldn't be against it, but aren't polyfills generally outside the scope of Civet?

from civet.

edemaine avatar edemaine commented on September 8, 2024

I agree that it seems out of the scope, given that this proposal seems to be a standard-library feature instead of a language feature. (Let me know if I misread.) So it seems you that you can just include an existing JS polyfill, and it'll work great with Civet.

from civet.

danielbayley avatar danielbayley commented on September 8, 2024

given that this proposal seems to be a standard-library feature instead of a language feature. So it seems you that you can just include an existing JS polyfill

Ah of course, makes sense. Do you happen to know of a good one?

I did wonder if Civet could possibly have some kind of [...asyncThing] sugar for Array.fromAsync

from civet.

Related Issues (20)

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.