Replies: 10 comments
-
I agree 💯 with the proposed change. What worries me is the Do you have a plan for how to not break existing code, or break it minimally during the transition to the more explicit declarations? |
Beta Was this translation helpful? Give feedback.
-
Steps:
|
Beta Was this translation helpful? Give feedback.
-
Looks good to me. |
Beta Was this translation helpful? Give feedback.
-
I 100% support this also. Very welcome change |
Beta Was this translation helpful? Give feedback.
-
I used to be against this, but now I support it. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I've always been against it. Compilers should make things easier, instead of propagating the same silliness as always. V should be able to figure out when the However, most programmers continue to try to force V to be like C, so they use (or don't use) the |
Beta Was this translation helpful? Give feedback.
-
@JalonSolov you do make a good point. That was my reasoning as well when I implemented this feature. I think it would work well if it was like Python, where value/reference thing is completely hidden. But V does have &Foo/Foo, and it gets confusing here, where |
Beta Was this translation helpful? Give feedback.
-
I'd rather disallow &Foo/Foo. :-) |
Beta Was this translation helpful? Give feedback.
-
Yeah I know :) perhaps we can make a slower and simpler version of V (or a flag), where there's no &Foo :) so that it works like Python and is used in high level apps where performance is not important |
Beta Was this translation helpful? Give feedback.
-
When I started V I wanted to make a language of the future, where caring about pointers/memory is not necessary. That's why I introduced this feature and all the automatic Foo/&Foo conversions. V ended up being used in lots of low level/high perf environments, and this caused problems. Perhaps having two different versions for low/high level code is a viable option. |
Beta Was this translation helpful? Give feedback.
-
Describe the feature
Current behavior:
I'm encouraged to use
mut f Foo
so that the fact that the receiver will actually be passed as a pointer will be lost and made implicit.Since the language positions itself as simple, there should be less implicit things in it.
Use Case
See previous part.
Proposed Solution
The compiler should give an error for the following definition:
This way the compiler checks that the code explicitly describes the fact that the value will be passed by pointer. This will reduce the implicitness in the language.
Other Information
No response
Acknowledgements
Version used
V 0.3.2 89aa695.865c0ea
Environment details (OS name and version, etc.)
Beta Was this translation helpful? Give feedback.
All reactions