We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
VerdagonSite/src/blog/0.2/concept-functions.vmd
Line 53 in da63cb0
Not sure when exactly, but they had been implemented for a few years by 2022 when the article was published. The current state: https://nim-lang.org/docs/manual_experimental.html#concepts The redesign (testing implementation exists): nim-lang/RFCs#168
type Strong = concept t t.strength is int Damaging = concept a, b calcDamage(a, b) is int func calcDamage(attacker, target: Strong): int = attacker.strength - target.strength func battle(attacker, defender: Damaging): int = calcDamage(attacker, defender) type Ship = object strength: int let rocinante = Ship(strength: 10) let bessie = Ship(strength: 9000) echo bessie.battle(rocinante)
The text was updated successfully, but these errors were encountered:
Added a mention for Nim's concepts, thanks for the heads up!
Sorry, something went wrong.
No branches or pull requests
VerdagonSite/src/blog/0.2/concept-functions.vmd
Line 53 in da63cb0
Not sure when exactly, but they had been implemented for a few years by 2022 when the article was published.
The current state: https://nim-lang.org/docs/manual_experimental.html#concepts
The redesign (testing implementation exists): nim-lang/RFCs#168
The text was updated successfully, but these errors were encountered: