Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
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

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions