Fix: Several mistakes in docs#791
Fix: Several mistakes in docs#791wizard7377 wants to merge 1 commit intobrainboxdotcc:devfrom wizard7377:docs_fix
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Mishura4
left a comment
There was a problem hiding this comment.
This review only applies to advanced_reference/coroutines.md, I haven't looked at the other files.
advanced_reference/coroutines.md is going to receive a lot of changes in #763, please wait until it is merged (or remove the changes from this PR and I can add them on my end)
| ### What is a coroutine? | ||
|
|
||
| Introduced in C++20, coroutines are the solution to the impracticality of callbacks. In short, a coroutine is a function that can be paused and resumed later : they are an extremely powerful alternative to callbacks for asynchronous APIs in particular, as the function can be paused when waiting for an API response, and resumed when it is received. | ||
| Introduced in C++20, coroutines are the solution to the impracticality of callbacks. In short, a coroutine is a function that can be paused and resumed later: they are an extremely powerful alternative to callbacks, for asynchronous APIs in particular, as the function can be paused when waiting for an API response, and resumed when it is received. |
There was a problem hiding this comment.
This extra colon makes it harder to read, can you remove it?
|
|
||
| \attention As a rule of thumb when making dpp::task objects and in general coroutines, always prefer taking parameters by value and avoid capture : this may be confusing but a coroutine is *not* the lambda creating it, the captures are not bound to it and the code isn't ran inside the lambda. The lambda that returns a dpp::task simply returns a task object containing the code, which goes on to live on its own, separate from the lambda. | ||
| Similarly, with reference parameters, the object they reference to might be destroyed while the coroutine is suspended and resumed in another thread, which is why you want to pass by value. See also [lambdas and locals](/lambdas-and-locals.html) except this also applies to parameters in the case of coroutines. | ||
| \attention As a rule of thumb when making `dpp::task` objects, and in general for coroutines, always prefer taking parameters by value and avoid captures: this may be confusing but a coroutine is *not* the lambda creating it, the captures are not bound to it and the code isn't run inside the lambda. The lambda that returns a `dpp::task` object containing the code, which goes on to live on its own, separate from the lambda. |
There was a problem hiding this comment.
Can you also remove this colon for the same reason as above?
The rest of the changes on this line are fine.
| \note The next example assumes you are already familiar with how to use [slash commands](/firstbot.html), [parameters](/slashcommands.html), and [sending files through a command](/discord-application-command-file-upload.html). | ||
|
|
||
| Coroutines allow to write asynchronous functions almost as if they were executed synchronously, without the need for callbacks, which can save a lot of pain with keeping track of different data. Here is another example of what is made easier with coroutines : an "addemoji" command taking a file and a name as a parameter. This means downloading the emoji, submitting it to Discord, and finally replying, with some error handling along the way. | ||
| Coroutines allows creation of asynchronous functions almost as if they were executed synchronously, without the need for callbacks, which can save a lot of pain with keeping track of different data. Here is another example of what is made easier with coroutines: an "addemoji" command taking a file and a name as parameters. This means downloading the emoji, submitting it to Discord, and finally replying, with some error handling along the way. |
There was a problem hiding this comment.
This is wrong, Coroutines is plural so you'd say allow. Regardless this entire section will be removed in #763
| Running the builds is the same as any other time, but we'll still cover it! However, we won't cover running it in background and whatnot, that part is completely down to you. | ||
|
|
||
| First, you need to get into the jenkins user. If you're like me and don't have the Jenkins user password, you can login with your normal login (that has sudo perms) and do `sudo su - jenkins`. Once logged in, you'll be in `/var/lib/jenkins/`. From here, you'll want to do `cd workspace/DiscordBot` (make sure to replace "DiscordBot" with your bot's name. Remember, you can tab-complete this) and then `cd build`. Now, you can simply do `./DiscordBot`! | ||
| First, you need to get into the jenkins user. If you're like me and don't have the Jenkins user password, you can login with your normal login (that has sudo perms) and do `sudo su - jenkins`. Once logged in, you'll be in `/var/lib/jenkins`. From here, you'll want to do `cd workspace/DiscordBot` (make sure to replace "DiscordBot" with your bot's name. Remember, you can tab-complete this) and then `cd build`. Now, you can simply do `./DiscordBot`! |
There was a problem hiding this comment.
No need to change /var/lib/jenkins/ to /var/lib/jenkins
Fixes for several trivial mistakes in docs, including spelling, grammar, and incorrect/outdated information.