Skip to content

Replace private var by private[this] var where possible #3241

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

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

smarter
Copy link
Member

@smarter smarter commented Oct 3, 2017

No description provided.

@smarter smarter requested a review from odersky October 3, 2017 16:58
@odersky
Copy link
Contributor

odersky commented Oct 4, 2017

Why do it? It does not make the code more beautiful, for sure.

@smarter
Copy link
Member Author

smarter commented Oct 4, 2017

Makes the intended usage more explicit, and it generates less bytecode (direct field access instead of accessor method calls). I agree that the syntax is not the nicest, I think @Ichoran suggested my as an alias for private[this] to encourage its use, that would help ;).

@smarter
Copy link
Member Author

smarter commented Oct 4, 2017

test performance please

@dottybot
Copy link
Member

dottybot commented Oct 4, 2017

performance test scheduled: 14 job(s) in queue, 1 running.

@dottybot
Copy link
Member

dottybot commented Oct 4, 2017

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/3241/ to see the changes.

Benchmarks is based on merging with master (de7b370)

@odersky
Copy link
Contributor

odersky commented Oct 5, 2017

How much less bytecode is generated? Performance data don't indicate a change in speed.

@smarter smarter merged commit b8d1e41 into scala:master Oct 10, 2017
@allanrenucci allanrenucci deleted the private-this-var branch December 14, 2017 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants