Skip to main content
-2 votes
2 answers
104 views

In a CGI script that processes arrays of strings the user can supply for each field whether to match a string there or not. If all user-specified criteria are fulfilled, the specific array should be ...
U. Windl's user avatar
  • 4,748
1 vote
1 answer
104 views

I am trying to get the following simple apply function to compile (simlified for example): struct Context(i32); pub async fn apply<F, Fut>(ctx: &mut Context, f: F) where F: Fn(&mut ...
ChrisB's user avatar
  • 4,156
1 vote
1 answer
89 views

I was experimenting with closures in JavaScript and ran into something confusing. function outer() { let x = 10; return new Function("return x;"); } const fn = outer(); console.log(fn()); I ...
Prince verma's user avatar
1 vote
2 answers
81 views

I have a Rust stub library that implements a FFI of an API written in C, so the some of the types are fixed. I have a function similar to this: pub type StoreFileCb = ::std::option::Option< ...
DerKastellan's user avatar
2 votes
0 answers
105 views

Follow-up to: Detailed Explanation of Variable Capture in Closures Given that captured variables are implemented as fields in compiler-generated classes (as explained in the referenced answer), does ...
Jasper's user avatar
  • 39
0 votes
0 answers
53 views

I'm trying to understand how setTimeout works inside a loop in JavaScript. I expected it to print numbers from 1 to 5, each printed after one second, but instead, it prints the number 6 five times. ...
Annadanapu Mahitha's user avatar
5 votes
1 answer
79 views

I have the following code: fn test() -> (impl FnMut(&mut u8), impl FnMut(&mut u8)) { let a = |v: &mut u8| {*v = 0}; let b = move |v: &mut u8| { a(v); println!("{}&...
Nils Oskar Nuernbergk's user avatar
0 votes
1 answer
185 views

Consider the following code: int main() { int n = 0; return [n] { return n; }(); // ok } According to https://cppinsights.io, the code above will be translated into the following code: int ...
xmllmx's user avatar
  • 44.6k
-2 votes
1 answer
72 views

I'm trying to set GLOBAL variable available across all modules of Node.js app. module.exports = app => { app.get('/config', async (req, res) => { ..... const { data } = await axios....
John Glabb's user avatar
  • 1,711
0 votes
0 answers
35 views

I’m trying to understand the difference in behavior between let and var inside a for loop, especially when used with setTimeout. Here’s a simple example: for (var i = 0; i < 3; i++) { setTimeout((...
Ritam Laha's user avatar
0 votes
0 answers
36 views

I'm debugging a performance regression in a hot code path and found that V8 is deoptimizing a function that uses closures in a monomorphic way. Here’s a simplified version of the pattern function ...
Bet Co's user avatar
  • 29
2 votes
1 answer
96 views

My problem is fairly simple: I'm trying to execute a file on a timer elapsed event. I use a closure to preserve the value of my variable. But I think I struggle to understand what is the lifetime of ...
Rouge a's user avatar
  • 25
1 vote
1 answer
65 views

I'm curently exploring Lua (5.4.7) vm implementation, it's relatively simple but i can't figure our how return works in case of vararg functions. functions with fixed amount of params are quite simple,...
vanilla's user avatar
  • 145
1 vote
1 answer
56 views

I'm writing a bot on Rust via teloxide + tokio. I have this run method (called from main) pub async fn run() { dotenv::dotenv().ok(); pretty_env_logger::init(); log::info!("Starting ...
Skyman2413's user avatar
0 votes
0 answers
56 views

I have following classes final class GroovyValidator { @Override public List<String> validate(String script) { final CompilerConfiguration config = new CompilerConfiguration(); ...
CoCumis's user avatar
  • 99

15 30 50 per page
1
2 3 4 5
604