Need help with delegates and vibed

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 16 13:08:40 PDT 2016


I can't understand how to get works delegates works from this doc 
http://vibed.org/api/vibe.http.client/requestHTTP

I see example, but when I am looking on Prototypes I really can't 
figure how to use them.

For example what does this mean:
  scope void delegate(scope HTTPClientRequest) requester,

it's function that point to method inside class? Why I can not 
call it like:

requestHTTP(url,
	scope req,
	scope res);

I am getting error:

Error: expression expected, not 'scope'
Error: found 'req' when expecting ','
Error: expression expected, not ','
Error: found 'scope' when expecting ','

---
Is it's optional parameter?

scope void delegate(scope HTTPClientRequest) requester = 
cast(void delegate(scope HTTPClientRequest req))null

so I can place instead in just `null`?




More information about the Digitalmars-d-learn mailing list