defer delete formatted strings in the tests in Line Up#187
defer delete formatted strings in the tests in Line Up#187rmonnet merged 4 commits intoexercism:mainfrom
defer delete formatted strings in the tests in Line Up#187Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
@0riginaln0, I looked at your change and I am not sure what the best solution is. There are two main allocators in Odin, the default There are two ways to format a string: The exercise author uses I think both solutions are valid in Odin: 1) use I am edging towards adding some comments stating that students should not use Does this make sense and do you have any suggestion? |
yep, sr. I didn't know it's a thing. Mine solution would be basically the same, but using My suggestion was the same as in the issue #186 . Relying on a temporary allocator just doesn't make sense in some exercises. Or even if they don't rely on temp, they still do produce solutions which have problems with memory management. Imo until there is an analyzer, it'll be good to guide students by exercise comments and test files warnings. |
rmonnet
left a comment
There was a problem hiding this comment.
I concur with the changes but additional changes are required:
- the
.meta/example.odinfiles is causing memory warning now since it is usingfmt.tprintf()and, per the discussion of the PR should be usingfmt.aprintf(), please modify and check that no memory warnings remains. - A
.docs/instructions.appends.mdfile should be added explaining that the exercise should be solved without usingfmt.tprintf()or the temporary allocator for data returned by the exercise API (internal use is still correct as long at the allocation do not bleed to the caller).
Please resubmit with the requested changes.
Thank you for the contribution to the Odin track.
rmonnet
left a comment
There was a problem hiding this comment.
The latest commit looks good. Merging now.
https://exercism.org/tracks/odin/exercises/line-up