Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Lots of avoidable imported package name shadowing #42

Open
quasilyte opened this issue Nov 17, 2018 · 0 comments
Open

Lots of avoidable imported package name shadowing #42

quasilyte opened this issue Nov 17, 2018 · 0 comments

Comments

@quasilyte
Copy link
Contributor

The vm receiver and argument name for v53 type is unfortunate as it's used in pair with vm package. When you have vm variable in scope, one can't access vm package.

It could be OK to rename vm to v, for example.

Simple example of shadowing is:

func (vm *v53) trace(instr vm.Instr) {
	if vm.thread().global.config.debug {
		fmt.Printf("vm @ ip=%02d fp=%02d: %v\n",
			vm.thread().frame().pc,
			vm.thread().frame().depth,
			instr,
		)
	}
}

Method gets vm receiver and refers to vm package in it's arguments list.
If function body will ever need something from that package, it would be an unpleasant experience to have.

@quasilyte quasilyte changed the title A lots of avoidable imported package name shadowing Lots of avoidable imported package name shadowing Nov 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant