Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

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

reference parameter should be checked. #15916

Closed
ghost opened this issue Sep 29, 2022 · 1 comment
Closed

reference parameter should be checked. #15916

ghost opened this issue Sep 29, 2022 · 1 comment
Labels
Feature Request This issue is made to request a feature.

Comments

@ghost
Copy link

ghost commented Sep 29, 2022

struct Foo{}

fn need_ref(f &Foo){}

fn main(){
	f := Foo{}
	need_ref(f)  // should be passed reference only.
}

Currently, need_ref(f) is legal, but it can easily cause bugs.
Therefore, it would be better to prohibit it and make sure that parameters passed to need_ref() are references.

@ghost ghost added the Feature Request This issue is made to request a feature. label Sep 29, 2022
@ghost
Copy link
Author

ghost commented Sep 29, 2022

This system of automatic conversion of references may seem convenient, but it is actually a source of trouble.
I have heard that the intention is to discontinue automatic conversion of references, and I hope that this will be corrected as soon as possible.

@vlang vlang locked and limited conversation to collaborators Jun 27, 2023
@medvednikov medvednikov converted this issue into discussion #18599 Jun 27, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

No branches or pull requests

0 participants