Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Concept] Docs - Functions #699

Merged
merged 6 commits into from
Aug 6, 2023
Merged

[Concept] Docs - Functions #699

merged 6 commits into from
Aug 6, 2023

Conversation

vaeng
Copy link
Contributor

@vaeng vaeng commented Aug 3, 2023

This concept is called functions, although the students are using functions from the first concept exercise.
I hope it is a good place, for them, as they introduce quite a lot of noise, that is needed for later concepts, but would not help in the early stages of the tree.

I would place these in the syllabus after references to make it clear, that a reference is also a change in the function type signature.

As an exercise, I am thinking to implement an advanced version of the lasagna cooking class from the first concept. This time it will be some bigger operation with recipes that cannot be changed and stuff that plays with overloads and defaults.

Closes #660.

@vaeng vaeng added x:action/create Work on something from scratch x:module/concept Work on Concepts x:type/content Work on content (e.g. exercises, concepts) x:rep/large Large amount of reputation labels Aug 3, 2023
@vaeng vaeng self-assigned this Aug 3, 2023
concepts/functions/about.md Outdated Show resolved Hide resolved
Copy link
Contributor

@siebenschlaefer siebenschlaefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

But do we really need const in this concept?
For me const is part of the type, leaving it out would make the section about function overloading simpler.

The section about function overloading sounds a little bit technical.
If that's what you're aiming for that's fine.
I'd prefer starting with the motivation, something like
"Multiple functions can have the same name if the number or types of the parameters are different. That is usually done if these functions perform very similar tasks just with different parameters or types."
But the decision is yours, I believe the syllabus is better if there's one consistent voice.

concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/.meta/config.json Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
@vaeng
Copy link
Contributor Author

vaeng commented Aug 4, 2023

But do we really need const in this concept? For me const is part of the type, leaving it out would make the section about function overloading simpler.

I have seen some examples where the const conversion was not clear in the code and I thought it might as well come in here. It does not feel enough for its own concept, but too much/late to go into a constexpr concept?

The section about function overloading sounds a little bit technical. If that's what you're aiming for that's fine. I'd prefer starting with the motivation, something like "Multiple functions can have the same name if the number or types of the parameters are different. That is usually done if these functions perform very similar tasks just with different parameters or types." But the decision is yours, I believe the syllabus is better if there's one consistent voice.

I should look at that, I want the whole thing to feel more fun and "aha, interesting" than a manual text.

@vaeng
Copy link
Contributor Author

vaeng commented Aug 6, 2023

@siebenschlaefer
Thank you for the feedback. I think it is much better now.
Would you be so kind and review the changes?

Copy link
Contributor

@siebenschlaefer siebenschlaefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Show resolved Hide resolved
concepts/functions/introduction.md Show resolved Hide resolved
@vaeng vaeng merged commit 9935c63 into main Aug 6, 2023
7 checks passed
@vaeng vaeng deleted the concept-docs-functions branch August 6, 2023 18:42
Copy link
Contributor

@siebenschlaefer siebenschlaefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last minute review of last minute changes

response = reply;
}
string answer(const string& question) const {
if (question.lenghth() == 0) { return "";}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found a typo! :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no! I will put that into the exercise for that concept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/create Work on something from scratch x:module/concept Work on Concepts x:rep/large Large amount of reputation x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Function in C++ Concepts
2 participants