Skip to content
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

relax the check of no new variables on left side of := #469

Closed
gopherbot opened this issue Dec 27, 2009 · 4 comments
Closed

relax the check of no new variables on left side of := #469

gopherbot opened this issue Dec 27, 2009 · 4 comments
Labels
FrozenDueToAge LanguageChange Suggested changes to the Go language

Comments

@gopherbot
Copy link
Contributor

by vincent.risi:

This is not a bug but if the := already allows for some of the variable to 
be old, why not allow for them all to be old?

for instance I would like to have 

  a, b := Called(x)
  ...
  a, b := Called(a*b)

as it does not really affect the usability if this was relaxed.
@rsc
Copy link
Contributor

rsc commented Dec 28, 2009

Comment 1:

On the other hand, code that uses := intends to declare
a new variable.  If there are no new variables to declare, that
seems worth mentioning.

Labels changed: added languagechange.

Status changed to Thinking.

@gopherbot
Copy link
Contributor Author

Comment 2 by soniakeys:

One could argue in favor of strengthening the check and requiring all variables to be
new.  The way it stands, you can't tell by looking at short declaration of multiple
variables which, if any of the variables are existing.  You have to read back through
the code and hunt for previous declarations of each variable.  If I add a short
declaration to some code, I might like the compiler to complain if I am stepping on
an existing variable.

@griesemer
Copy link
Contributor

Comment 3:

This issue should be considered together with issue #377.

@rsc
Copy link
Contributor

rsc commented Jan 19, 2010

Comment 4:

Status changed to Duplicate.

Merged into issue #377.

@gopherbot gopherbot added duplicate LanguageChange Suggested changes to the Go language labels Jan 19, 2010
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge LanguageChange Suggested changes to the Go language
Projects
None yet
Development

No branches or pull requests

3 participants