similar to: Strange Interaction Between Promises and Closures (PR#13861)

Displaying 20 results from an estimated 10000 matches similar to: "Strange Interaction Between Promises and Closures (PR#13861)"

2001 Sep 16
1
Using closures in libraries
I was trying to use closures within a library as follows - foo <- local({ # some code creating local variables function() { # uses the local variables created above }) It did not work because call to do_libfixup in library replaces all the closure environments by the global environment. One way around this would be to do the replacement only for closures that have the same
2013 Jan 26
0
[LLVMdev] Closures, newbie question
On 26/01/13 19:20, Torsten Rüger wrote: [...] > Just at the end it mentions closures and I was wondering how those are done in llvm. > The link was to wikipedia, and i do know what closures/blocks/continuations are, (i think) but maybe someone could point me to where to read about how to do them in llvm. I've implemented closures in the past --- it's fiddly and a surprising amount
2013 Jan 26
2
[LLVMdev] Closures, newbie question
So I read the Kaleidoscope tutorial, big thanks to Chris Latter. Good pace, still excellent coverage. Just at the end it mentions closures and I was wondering how those are done in llvm. The link was to wikipedia, and i do know what closures/blocks/continuations are, (i think) but maybe someone could point me to where to read about how to do them in llvm. Thanks Torsten
2008 Dec 28
3
[LLVMdev] Efficient implementation of closures?
A somewhat random question: I'm wondering if there's any kind of trick in LLVM that would allow me to implement closures efficiently. We can assume that a closure function has a hidden parameter which points to its environment, that is, the values of the variables which were in scope at the point where the closure function was defined. The problem comes when mixing closure and
2013 Jun 30
2
[LLVMdev] Implementing closures and continuations
Hi all, In getting to know the LLVM infrastructure, I'm having a hard time finding implementation details for closures and continuations. For closures, I've read comments such as "using a struct" as an environment to hold references to free variables, linked lists to dictionaries for various scope levels, and even things like "it's just like virtual methods". I
2013 Jun 30
0
[LLVMdev] Implementing closures and continuations
On Sat, Jun 29, 2013 at 7:51 PM, David Farler <accumulator at icloud.com>wrote: > Hi all, > > In getting to know the LLVM infrastructure, I'm having a hard time finding > implementation details for closures and continuations. > > For closures, I've read comments such as "using a struct" as an > environment to hold references to free variables, linked
2013 Jun 30
1
[LLVMdev] Implementing closures and continuations
> On Jun 29, 2013, at 9:53 PM, Eli Friedman <eli.friedman at gmail.com> wrote: > >> On Sat, Jun 29, 2013 at 7:51 PM, David Farler <accumulator at icloud.com> wrote: >> Hi all, >> >> In getting to know the LLVM infrastructure, I'm having a hard time finding implementation details for closures and continuations. >> >> For closures,
2010 Aug 26
1
list of closures
Hi, I wanted to create a list of closures. When I use Map(), mapply(), lapply(), etc., to create this list, it appears that the wrong arguments are being passed to the main function. For example: Main function: > adder <- function(x) function(y) x + y Creating list of closures with Map(): > plus <- Map(adder,c(one=1,two=2))> plus$one(1)[1] 3> plus$two(1)[1] 3 Examining what value
2012 Jan 19
2
What is a 'closure'?
The "R Language Definition" at http://cran.r-project.org/doc/manuals/R-lang.html states in the following section 4.3.2 Argument matching This subsection applies to closures but not to primitive functions. What are 'closures'? [[alternative HTML version deleted]]
2019 Jul 24
1
Re: [PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
On 7/24/19 11:54 AM, Richard W.M. Jones wrote: > Previously closures had a crude flag which tells if they are > persistent or transient. Transient closures (flag = false) last for > the lifetime of the currently called libnbd function. Persistent > closures had an indefinite lifetime which could last for as long as > the handle. In language bindings handling persistent closures
2019 Jul 24
2
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
On 7/24/19 7:17 AM, Richard W.M. Jones wrote: > In preparation for closure lifetimes, split up the Closure so it no > longer describes a list of closures, but a single callback. > > This changes the API because functions which take 2 or more closures > now pass a separate user_data for each one. > --- > docs/libnbd.pod | 3 +- >
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
On Mon, Sep 07, 2020 at 04:46:39PM -0500, Eric Blake wrote: > We have a memory leak when a function with a closure exits early prior > to registering that closure through some path that will guarantee > cleanup. The easiest way to fix it is to guarantee that once a > closure is passed into a public API, it will be cleaned regardless of > whether that API succeeds or fails. But to
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
On 7/16/19 6:04 AM, Richard W.M. Jones wrote: > A Closure is a list of (usually one, but can be more) closures. In C > there is also a singe ‘void *user_data’ parameter which is passed by > the caller into the function and through as the first parameter of > each callback invocation. > > By grouping the previously separate Opaque and Callback* parameters > together we can
2008 Nov 17
4
functional (?) programming in r
the following is a trivialized version of some functional code i tried to use in r: (funcs = lapply(1:5, function(i) function() i)) # a list of no-parameter functions, each with its own closure environment, # each supposed to return the corresponding index when applied to no arguments sapply(funcs, function(func) func()) # supposed to return c(1,2,3,4,5) there is absolutely nothing unusual in
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
On 7/24/19 7:17 AM, Richard W.M. Jones wrote: > Previously closures had a crude flag which tells if they are > persistent or transient. Transient closures (flag = false) last for > the lifetime of the currently called libnbd function. Persistent > closures had an indefinite lifetime which could last for as long as > the handle. In language bindings handling persistent closures
2018 May 03
1
The stages of standard function evaluation
Dear R Help folks -- I have been trying to put together a list of the steps or stages of R function evaluation, with particular focus on those that have "standard" or "nonstandard" forms. This is both for my own edification and also because I am thinking of joining the world of R bloggers and have been trying to put together some draft posting that might be useful. I seem to
2020 Sep 07
4
[libnbd PATCH 0/2] Fix memory leak with closures
As promised in my earlier thread on libnbd completion callback question. Eric Blake (2): generator: Refactor handling of closures in unlocked functions generator: Free closures on failure docs/libnbd.pod | 2 +- generator/C.ml | 48 +++++++++++------ generator/C.mli | 1 + lib/debug.c | 7 +-- lib/opt.c | 31 ++++++-----
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
This change does not affect the output of the generator. Note this requires that all Closure args have the same parameter name whichever method they appear in. An alternate refactoring could work the same way as Flags and Enum where the parameter name is part of the arg, eg: type arg = ... | Closure of string * closure (* name, type *) ... "set_debug_callback", {
2016 May 20
2
identical on closures
Specifically, the srcfile attribute of the srcref attribute of the two instances of the functions contain different environments, AFAICT. Environments are compared only by exact pointer, so this forces return FALSE. Snippets from .Internal(inspect(x)) and .Internal(inspect(y)): @cca008 03 CLOSXP g0c0 [MARK,NAM(2),ATT] FORMALS: @604b58 00 NILSXP g0c0 [MARK,NAM(2)] BODY: @cc9650 06 LANGSXP
2016 May 20
2
identical on closures
I'm confused by this: > identical(function() {}, function() {}) [1] FALSE Yet, after loading the Matrix package (which redefines det), the following is checked (in library.checkConflicts): > identical(get("det", baseenv()), get("det", asNamespace("Matrix")), ignore.environment=T) [1] TRUE I've looked at the code in identical.c and for closures it