Jason House wrote:
downs Wrote:
Let me say first that I don't use std.bind myself, but tools.base:fix fills
essentially the same need - creating full closures from dynamic ones.
Say you have a function that takes a number and returns a delegate that does
something with that number.
void delegate() test(int i) { return { return i + 2; }; }
In 2.0 this will ......................
Oh.
Nevermind. I don't know what to use bind for after all :)
In fact, I suspect it's essentially useless in 2.0. Creating full closures was
my only use case :)
I look at bind as the difference between by reference and by value semantics. When using
scope delegates (or delegates that could be scope delegates), this difference rarely
matters. When passing data between threads, the need to pass by value becomes more
important. "By value" may even require a deep copy.
Even though I can see uses for some kind of bind functionality in D2, I need to see where
all this "shared" object stuff goes before I know what/if a D2 bind library
should do.
I've always thought currying was the main point of std.bind. If I'm not
mistaken, currying is commonly a built-in feature of functional
programming languages, so if anything, std.bind could become more
useful/important in D2 than in D1.
I agree that the std.bind API could and should be improved.
-Lars