exercism / cpp

Exercism exercises in C++.
https://exercism.org/tracks/cpp
MIT License
254 stars 207 forks source link

[Concept] Docs - Functions #699

Closed vaeng closed 1 year ago

vaeng commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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