Git Product home page Git Product logo

Comments (3)

lionel- avatar lionel- commented on May 26, 2024

inject() is a valid approach to metaprogramming. But I wonder, from what information would you generate the formals? I think you're looking for the equivalent of rlang::new_function() where you'd pass formals, env, and body individually?

from coro.

ElianHugh avatar ElianHugh commented on May 26, 2024

Right, I was looking exactly for something analogous to rlang::new_function. I was trying to modify the formals via formals but that seems to not work as expected, and also drops the aync function class

As an aside, I don't mean to suggest inject is hacky, more that it feels like a workaround. Technically I can create an anonymous function through rlang::new_function, but that will end up as a name when passed to assert_lambda

from coro.

lionel- avatar lionel- commented on May 26, 2024

The tricky part is that async() takes calls to function instead of evaluated functions.

These calls are a bit tricky, see as.list(quote(function(foo) bar)) for the contents. The second element is a pairlist not a list.
If you create a call following this structure (e.g. turn the result of the previous example back to a call with as.call()), then you can inject it inside async().

I agree a new_ function would be much better.

from coro.

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.