FAQ
I'm not convinced this is a real problem. You usually don't use names of
packages you have imported (and are using!) anyway.

On Fri, Feb 22, 2013 at 1:11 AM, Nate Finch wrote:

Sorry, terrible example... I meant something like this:

http://play.golang.org/p/FrcUIT21Go

type M struct{}

func (m M) Max() int {
return 5
}

func foo() {
math := M{}
fmt.Println(math.Max())
}

If shadowing didn't work, importing math would suddenly break this program.
On Thursday, February 21, 2013 6:34:46 PM UTC-5, John Nagle wrote:
On 2/21/2013 7:16 AM, Nate Finch wrote:
If you later import "math" into this file, this function suddenly becomes
invalid if you can't shadow. Since anyone can name imports whatever they
want, this could be a huge pain (yes you could rename the import).
"import" only brings in upper case variables, right? (Except for
the module name itself.)

** John Nagle

--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

People

Translate

site design / logo © 2021 Grokbase