You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect two kinds of functions. The first one changes the passed array without allocations for new arrat, in place. The second creates a copy and returns it, so that it is clear that a copy is being created.
Here we have the second behavior, however, the assignment to an array that changes is hidden from the user's eyes. I think this is bad behavior, as it can lead to hard-to-catch bugs
Use Case
See above
Proposed Solution
Let's split to two methods:
// delete_many deletes `size` elements beginning with index `i` and return new array.pub fn (a array) delete_many(i int, size int) array
and
// delete_many_in_place deletes `size` elements beginning with index `I`// in place.pub fn (mut a array) delete_many_in_place(i int, size int)
Feature/Enhancement RequestThis issue is made to request a feature or an enhancement to an existing one.Unit: vlibBugs/feature requests, that are related to the vlib.
1 participant
Converted from issue
This discussion was converted from issue #17174 on June 27, 2023 10:00.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature
Current method has very unexpected behaviour.
I would expect two kinds of functions. The first one changes the passed array without allocations for new arrat, in place. The second creates a copy and returns it, so that it is clear that a copy is being created.
Here we have the second behavior, however, the assignment to an array that changes is hidden from the user's eyes. I think this is bad behavior, as it can lead to hard-to-catch bugs
Use Case
See above
Proposed Solution
Let's split to two methods:
and
Other Information
No response
Acknowledgements
Version used
V 0.3.3 21b17fe.d563739
Environment details (OS name and version, etc.)
Beta Was this translation helpful? Give feedback.
All reactions