Skip to content

Conversation

@rmonnet
Copy link
Contributor

@rmonnet rmonnet commented Jan 16, 2026

In Odin, the solution stub generates a compilation error rather than a failed test. This is confusing to the student and contrary to the philosophy we use for the other exercises. I added a zero value default to the parameter to convert the compile error to a failed test. Since this is the only exercise where we have to define a default parameter, I added Odin specific instructions explaining how to use default parameters in Odin.

@rmonnet rmonnet added x:action/improve Improve existing functionality/content x:type/content Work on content (e.g. exercises, concepts) labels Jan 16, 2026
@glennj
Copy link
Contributor

glennj commented Jan 16, 2026

I think the doc gives the "how" but is missing the "what and why". Something like

The parameter list of a procedure declares the type or each parameter.
The caller of a procedure must supply values to assign to each of the parameters.
To allow some flexibility, Odin can provide a default value to a parameter so the caller does not have to explicitly provide a value.

That's crap, my brain is not fully engaged this morning.

Maybe linking to https://odin-lang.org/docs/overview/#parameters

@glennj
Copy link
Contributor

glennj commented Jan 16, 2026

Google Gemini gave me this which is still not great.

In a strongly-typed language like Odin, default parameters improve usability by reducing repetitive code and allowing for non-breaking API updates. This feature doesn't compromise type safety, as the compiler simply substitutes the default when a value is omitted, ensuring the function always receives a value of the correct type.

@rmonnet
Copy link
Contributor Author

rmonnet commented Jan 16, 2026

@glennj,

good point. I rewrote the additional instructions using your comments above. I found that, once I try to explain the why, I had to discuss procedure overloading and named arguments. Once we start the concept track, we may need a concept on this specific topic.

Let me know what you think of the updated doc.

@glennj
Copy link
Contributor

glennj commented Jan 16, 2026

Nice!

Link to docs?

[named-arguments]: https://odin-lang.org/docs/overview/#named-arguments
[default-values]: https://odin-lang.org/docs/overview/#default-values

In Odin, the solution stub generates a compilation error rather
than a failed test. This is confusing to the student and
contrary to the philosophy we use for the other exercises.
I added a zero value default to the parameter to convert the
compile error to a failed test. Since this is the only
exercise where we have to define a default parameter, I added
Odin specific instructions explaining how to use default
parameters in Odin.
Added some explanation of why default parameters is a useful
feature and how to use them in Odin.
@rmonnet
Copy link
Contributor Author

rmonnet commented Jan 16, 2026

Added a link to the Odin overview as suggested.

@rmonnet rmonnet merged commit a544732 into exercism:main Jan 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:action/improve Improve existing functionality/content x:type/content Work on content (e.g. exercises, concepts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants