Comments (3)
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.
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.
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)
- Iterate could return invisibly HOT 2
- %do% operator? HOT 2
- timeline before this is available on CRAN? HOT 6
- Rename `_step` functions
- Arity-1 generators HOT 2
- yield_from() HOT 1
- Allow as_iterator extensions via S3 methods HOT 1
- Some weird behaviour in async HOT 2
- Error when making generator a method of an R6 class HOT 5
- Yield in nested iterators HOT 1
- Questions about yield differences between collect and loop/for HOT 2
- Loops and missing else branches in `async()` functions should return promises to `NULL`
- Running coro in R scripts HOT 2
- Use an unlikely sentinel
- Memory leak when a generator is created inside a function HOT 6
- coro upkeep 2023
- Async function errors should not be raised in the main thread HOT 1
- How to pass rcmdcheck using generators HOT 2
- coro as an optional dependency 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 coro.