Replies: 4 comments 8 replies
-
I think it's ok, but only strictly as an option. For those few % of cases where it's really wanted/needed. Similar to manual memory management option, which we support. |
Beta Was this translation helpful? Give feedback.
-
My interpretation of the context about this, is the language and it's syntax stays convenient for the average/most users, and then they can choose other methods of memory management (beyond the default) based on their need. V's performance with the default GC is very good (in addition to providing memory safety), which will be fine for most users. For those advanced users and certain situations, they have autofree and arena allocation. Possibly something else in the future as well. Thus, V's stated focus on providing flexible/optional memory management. Unlike other languages, users are not hit with or burdened with unnecessary difficulties and problems. If the task specifically requires a different kind of memory management or if an advanced user wants to handle memory management differently, then V can provide other options which are compatible with its core design principles and goals. |
Beta Was this translation helpful? Give feedback.
-
Implement a compile-time enforced ownership/borrowing system with these rules: Ownership Rules Values have single owners 1.Assignment transfers ownership (move semantics)
2.Borrowing Syntax Immutable borrowing (&T):
Mutable borrowing (&mut T):
3.Compiler Enforcement Prevent use-after-move Enforce borrowing rules: Only one mutable borrow OR multiple immutable borrows No borrowing after ownership transfer Automatic lifetime validation Key Benefits No dangling pointers No data races No null dereferences 2.Zero Runtime Overhead All checks at compile-time 3.Minimal Syntax Only 3 new operators: &, &mut, * (dereference) 4.Backward Compatibility Opt-in via compiler flag initially Critical Checks
Implementation Requirements 2.Borrow checker with scope analysis 3.Move semantics for assignments/parameters 4.Lifetime inference engine |
Beta Was this translation helpful? Give feedback.
-
For embedded systems that require performance, security, and low memory usage, v is more suitable for embedded development if it can support a simplified version of compile-time memory management. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
MoJo Confirm Use Ownership:https://docs.modular.com/mojo/manual/values/
Ownership is a great invention. I think V language should not abandon it completely. Using some of its best parts will be better for the future development of V language.
And ownership should be the same as manually managed memory, compatible with autofree and gc compilation methods
As officially described, V's official package is provided through autofree to support compilation methods such as gc and autofree. However, it is also said that the performance of the autofree method provided by V is not necessarily better than that of gc. Not only is it laborious to manage memory manually, it can also easily lead to memory leaks. As time goes by and the complexity of packages grows, how to better maintain these packages becomes a problem. All limited support ownership will give V a better future
Beta Was this translation helpful? Give feedback.
All reactions