On Sun, Jan 14, 2018 at 9:15 AM, Dan Lüdtke <m...@danrl.com> wrote:
>
> looking for some insights regarding Sum256, especially line 139.
> https://golang.org/src/crypto/sha256/sha256.go?#L139
> Doesn't the statement `len := d.len` shadow the len() function and isn't
> that supposed to be "bad style" or am I missing something here? If it is
> shadowing, is this OK to do for specific cases or shall I avoid this in my
> own code in general?

Shadowing a builtin is less confusing than shadowing a func/var you
define yourself, but, yes, in my opinion this isn't great style and as
a general rule should probably be avoided.  In this case I would
consider renaming the field and the variable to something else.

Ian

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to