gilbert189 — 10/30/2022, 1:53:47 PM
function something(a, b, c){
  return function(){/* code that uses a, b, and c */}
}

How should I call this type of function?

♥ 1 ↩ 0 💬 15 comments

comments

pkmnq:

What does this accomplish that this can’t?

function something2(a, b, c) {
   /* code that uses a, b, and c */
}

// use something2.bind(null, a, b, c) instead of something(a, b, c)
10/31/2022, 9:44:40 AM
pkmnq:

If it has its own use, then I think it could be called a “pseudo-bound function”.

10/31/2022, 9:45:29 AM
gilbert189:

I don’t think that’s how you’re supposed to use bind

10/31/2022, 11:06:12 AM
pkmnq:

The feature exists, therefore it exists

10/31/2022, 12:27:28 PM
gilbert189:

I can mix tabs and spaces when indenting on Python, yet we’re told not to do it.

10/31/2022, 12:47:29 PM
pkmnq:

And that’s for a reason. I can’t think of any reasons why using bind in this way would be a bad idea. If you have some, list all of them.

10/31/2022, 3:14:23 PM
gilbert189:

I can mix tabs and spaces when indenting on Python, yet we’re told not to do it.

10/31/2022, 12:47:31 PM
gilbert189:

s/we’re/we’ve been

10/31/2022, 12:50:58 PM
lily:

wouldn’t you need to then run

something(x,y,z)()
10/30/2022, 4:32:54 PM
gilbert189:

Exactly.

10/31/2022, 12:36:52 AM
wynd:
function something(a,b,c){
    return (a,b,c) => {
        
    }
}
10/30/2022, 2:58:37 PM
gilbert189:

No that’s not how it works

10/30/2022, 3:12:08 PM
wynd:

maybe just use a class

10/30/2022, 3:51:25 PM
wynd:

something(1,2,3)

10/30/2022, 2:57:02 PM
wynd:

oh wait one sec

10/30/2022, 2:57:27 PM