Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jaykrell
Copy link
Contributor

No description provided.

@jaykrell
Copy link
Contributor Author

@monojenkins build failed

@vargaz
Copy link
Contributor

vargaz commented Nov 17, 2019

The changes are ok but the const changes are not needed, we don't use const on locals in our codebase.

@jaykrell
Copy link
Contributor Author

It is so the human reader can likely skip looking for additional writes.
Isn't that a good thing?
Granted, you can cast it away, but that is rare.
Can we ever try to do better than prior practise?

@jaykrell
Copy link
Contributor Author

@monojenkins build failed

@BrzVlad
Copy link
Member

BrzVlad commented Nov 20, 2019

For me const doesn't add any benefit. If a local is constant you can pretty easily tell by the context, local name. I consider const everywhere is just adding code bloat.

@jaykrell
Copy link
Contributor Author

"code bloat" we are talking source code bloat, right?

The codegen will be the same. Just with the extra hint in the source for the human.

Being a local doesn't give the information. You have to scan the function -- could be a small function, not much to scan, could be a large function, much to scan.

Some code bases put const very liberally for this reason, like on almost every parameter.

@baulig
Copy link
Contributor

baulig commented Dec 12, 2019

I'm pretty much in favor of being const-ly correct ;-)

@lambdageek lambdageek merged commit 6a8ca22 into mono:master Jan 6, 2020
ManickaP pushed a commit to ManickaP/runtime that referenced this pull request Jan 20, 2020
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.

5 participants