[phobos] D std.bind

Andrei Alexandrescu andrei at erdani.com
Wed Jun 16 16:08:45 PDT 2010


(Readded Phobos) I wrote a curry in std.functional which I think could 
be a good starting point.

Andrei

Jason Spencer wrote:
> So is there a recommended way to approach arbitrary depth currying?  std.algorithm only allows one level.  Bind was the only one I knew of that would allow me to "nest" curries as deeply as I'd like to.  Other ideas?
> 
> Thanks,
> Jason
> 
> 
> ----- Original Message ----
>> From: Andrei Alexandrescu <andrei at erdani.com>
>> To: Jason Spencer <spencer8 at sbcglobal.net>
>> Cc: Discuss the phobos library for D <phobos at puremagic.com>
>> Sent: Wed, June 16, 2010 2:57:20 PM
>> Subject: Re: D std.bind
>>
>> (Added Phobos.) We haven't tested std.bind in a long time. With the advent of 
>> function literals etc., it seems pointless. Walter and I think it should be 
>> deprecated.
> 
> Andrei
> 
> Jason Spencer wrote:
>> Hi, 
>> I've 
>> been trying to get the simplest program that uses bind() to work with D 2.046 
>> (or 2.036 or 2.047), but I've run into problem after problem.  First, it 
>> seems D2 tightened up const handling, and the NullAlias struct of type const 
>> EmptySlot would match is expressions.  After fixing that, I'm now 
>> getting:
>>
>> C:\Jason\D>dmd bTest.d
>>
>> C:\tools\dmd2\windows\bin\..\..\src\phobos\std\binder.d(230): Error: alias 
>> std.bind.Tuple!().Tuple.meta template identifier prependT is not a member of 
>> alias meta
>> C:\tools\dmd2\windows\bin\..\..\src\phobos\std\binder.d(775): 
>> Error: no property 'prependT!(T)' for type 'Tuple!()'
>>
>> C:\tools\dmd2\windows\bin\..\..\src\phobos\std\binder.d(775): Error: alias 
>> std.bind.dynArgTypes!(i,Tuple!(int),Tuple!(DynArg!(0)),1).prependType!(int,DynArg!(0)).res 
>> cannot alias an expression __error
>>
>> I'm a D newbie, and the 
>> syntax is too much for to start on without getting a couple of practice programs 
>> down first.  
>> Do you know if anyone has tested std.bind in recent 
>> releases?  I've talked to Tom, but he doesn't seem to be supporting it, 
>> esp. in D 2.  I've also posted on DigitalMars.D.  Any other 
>> ideas?
>>
>> Thanks,
>> Jason


More information about the phobos mailing list