-
-
Notifications
You must be signed in to change notification settings - Fork 671
Functions concept #1720
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
Functions concept #1720
Conversation
397f82d to
ec78d77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for doing this! I've roughly reviewed this, but decided to hold off on some reviewing more to first solve the dependency cycles.
Fitting this concept/exercise into the existing hierarchy - I've done this somewhat, but if I add dependencies for everything that's relevant then I create cycles. Feedback welcomes from someone who has a more holistic view of the progression of concepts they think is right for the Go track.
@junedev could you perhaps take a look at how you envision the concept hierarchy? One immediate issue I could see was that this exercise depends on slices, but that the exercise teaching slices also teaches multiple returns. We could consider moving the multiple returns to this exercise? It's also important to note that we should decide if we want this to be an early exercise or not (as in: which exercises should depend on this)?
The concept introduction and exercise introduction are nearly identical. Is this OK/appropriate? (Should I just be using .docs/introduction.md.tpl if so?)
This is perfectly ok. At some point the .tpl files will get good support, but we have only basic support for it now so I'd ignore it.
.meta/design.md - this is my first attempt at one of these, I've read a few others but it's largely cargo cult.
It's perfectly fine.
Should my exercise include forked_from? It's not clear to me from the docs what the contents of this field would be? (I.e. is it just same track exercises, or can you reference cross tracks etc)
Forked from is exclusively for cross-track references. So in this case it should be:
`"forked_from": ["javascript/lasagna-master"]
Sounds good - thanks for the rough cut that was really helpful. Agree that we should sort the high level dependency issues and decide where this fits and what it can/can't depend on before we get into the minutiae. |
|
Disclaimer: I did not read the PR content yet, I am mostly responding to the question regarding the concept tree. The functions concept should include explaining multiple return values, not as a separate concept just as part of the content. This is where it belongs imo. Content can probably be copied. Thus multiple return values can be safely used as part of the exercise here. This exercise should have slices and structs as prerequisites. When you modify the scaleRecipe exercise to use a slice of structs instead of a map that should be enough to make it work. (Make sure not to use We can then later go ahead and remove the multiple return values concept from slices. The exercise would just need a minimal change, there is no conceptual dependency (unlike for maps, there you need multiple return values). Until then I don't think anyone will think this is bad track because we repeat a couple of lines of concept content. Everything that depended on multiple return values will then depend on functions later. The general hierarchy on the end would be that the student learns the basic types and conditionals, that unlocks slices and structs, which unlocks functions which unlocks maps. With regards to pointers I would go with the "learn the details later approach". Strictly speaking you would need pointers to understand how the complex types are passed to the function. However currently pointers has maps as prerequisite and I would like to keep it a bit further down the tree. So instead of going into the details here I would just talk about how the passing works for "reference types" and primitives. Does that help/ make sense? |
|
I had a quick look at the exemplar file:
|
|
@bobtfish Another thought regarding scaleRecipe. Instead of making it a slice of structs you could also just have a slice of floats an say "each item represents the amount of some ingredient ...". The task is about not modifying the argument so a slice will do to make this point. |
|
@bobtfish Setting this to draft for now. Mark as "ready for review" again whenever you are ready. |
I'm unsure about this - it's totally possible to do this, but the exercise is a lot nicer to solve if you can use Why do we imagine that this has to be before we cover |
Range iteration need to show how to iterate over maps so maps need to be known to the student, maps need multiple return values from here so we can't move maps before functions. |
Aha, got it, thanks for the explanation. I'll take |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done overall! I really like the examples you used in the concepts.
Some more small things need to be fixed before this can be merged and the merge conflict needs to be resolved.
c27feaa to
e502f58
Compare
Thanks!
All fixed up. I wasn't 100% sure what you were suggesting around the I've also rebased and squashed as it was getting unwieldy - no point committing adding then removing then re-adding the same thing , and that also allowed me to fix the merge conflict so it'll merge cleanly without a load of back-and-forth merges to make future history exploration easy. (I'm not sure if there's a house style/recommendation about merges/rebases for PRs in progress) |
This is my first attempt at something as ambitious as a full exercise and a concept, so any/all feedback and tips very gratefully received.
Specific things that I'm unsure about / have questions on:
forked_from? It's not clear to me from the docs what the contents of this field would be? (I.e. is it just same track exercises, or can you reference cross tracks etc)Fixes #1642