Fixes for documentation?
-
Monday, May 07, 2012 6:02 PM
In the following code fragments, don't you really mean: pplx::task<http::http_response > resp ?
(The closing > is missing.)
And once you have defined "resp", why use "r" from then on?
I see this code in http://msdn.microsoft.com/en-us/devlabs/hh976887.aspx
http::http_client client("http://localhost:80"); pplx::task<http::http_response resp = client.request(methods::GET, "/foo.html");Here, the ‘resp’ task provides us a placeholder for a value that will be available in the future.
Once you have a task, you need to (eventually) get a value out of it. Since it is possible that the operation finishes so fast that the value is available immediately, it may be reasonable to ask the task whether it is “done” or not:
bool done = r.is_done();
All Replies
-
Tuesday, May 08, 2012 1:52 AMOwner
Andrew,
Thank you for taking the time to scrutinize our stuff to this level of detail! I will open a documentation bug on this.
Niklas
- Proposed As Answer by Artur LaksbergOwner Tuesday, May 08, 2012 1:59 AM
-
Wednesday, May 09, 2012 3:01 AM
If possible, please review the actors documentation at:
http://msdn.microsoft.com/en-us/devlabs/hh975426.aspx
I was trying some of the code samples, and it seems that some functions on the header files have different signature/names that those on the samples. For example, in the code below, the actors::accept signature seems to differ from the .h file and I could not find (neither could VS11) an actors::ActorInitEvent in the references.
class Hello : public actors::actor { public: Hello() {} actors::actor *factory() { new Hello(); } protected: void initialize(actors::ActorInitEvent e) { } virtual void execute() { std::string name; accept(name).then([=](std::string &name) { std::cout << "Hello, " << name << "!" << std::endl; Done(); }); } };Thanks,
Fernando
- Edited by petvetbr Wednesday, May 09, 2012 3:04 AM
-
Wednesday, May 09, 2012 1:49 PMOwner
Yep, that's another problem. The documentation that is installed along when you unzip the samples is better, but it still has the accept(name) error, which should be accept<std::string>() instead. ActorInitEvent was "init_reason" to have the right casing and better describe its purpose.
While we address these issues for the next release, I recommend looking at the code in the BlackJackServer_Actors sample. That code really does compile... :-) It don't think it uses checkpointing or the choice function anywhere, but most aspects of the actors library are illustrated.
Niklas
- Proposed As Answer by petvetbr Wednesday, May 09, 2012 2:16 PM
- Marked As Answer by Artur LaksbergOwner Friday, May 11, 2012 5:36 PM
-
Wednesday, May 09, 2012 2:18 PMOwner
In case it is not clear -- the installed docs are available from the readme.htm file at the top level of the extracted ZIP file.
Niklas
-
Wednesday, May 09, 2012 2:55 PM
Ok, I'll study by the installed docs and the BlackJack project.
Thanks a lot for you help!
Fernando
-
Friday, May 11, 2012 2:17 PM
One more slight issue with the original example. Visual Studio doesn't care for this line
pplx::task<http::http_response resp = client.request(methods::GET, "/foo.html");
The second argument needs to be a wide string
pplx::task<http::http_response resp = client.request(methods::GET, L"/foo.html");
Peter Newhook SharePoint posts on my blog

