Jason Spencer wrote:
----- Original Message ---- From: Andrei Alexandrescu
<[email protected]>


I think you're close to the optimal. I'd probably drop function and
 write:

auto g1 = int(int b, int c, int d) { return g(2,b,c,d); };


That actually fails to compile in 2.047: curry.d(13): found '(' when
expecting '.' following int


All things considered, I'm not sure that that's worse than the arcana:

auto g1 = bind(&g, _1);

...

All in all, std.bind looks like a direct derivative of Boost's
design, which is built to deal with C++'s issues, and does not
avail itself of D's advantages.

It is at least shorter and comprehensible when glancing at it,
though.  I'm not a great fan of the boost syntax or implementation
ported to D either, but I also recognize the need for some easy way
to automate that much boiler plate code.  Maybe I'll futz around and
see if I can come up with a nice way of doing partial application.
If I can, could that be considered for inclusion in functional or
something?

Sure. I suggest you follow the pattern in std.functional of passing aliases around instead of the std.bind style. The latter is less efficient. Also I think a non-variadic solution (_0 to _9 are abhorrent) wouldn't fare too well.

Either way, I'd politely suggest that bind should either be fixed or
removed.  I assume it's been broken for 6 months now, and maybe 3
years, in D 2.0.  Seems a shame to throw away something that at least
fills a hole for the time being until something better comes along,
but it may be better to keep confidence in stability up.

Walter wanted to yank it for a long time. I agreed with some reluctance (I agree with the pros you mention) but I think it's best to deprecate the thing.


Andrei
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to