On Thu, Aug 25, 2016, 00:08 Sam Salisbury <samsalisb...@gmail.com> wrote:

> Would it be nice or nasty for this to work?
> https://play.golang.org/p/iCTKx3gF_2
>
> Copy-pasted:
>
> type Thing struct {
> Embedded struct {
> Name string
> }
> }
>
> func main() {
> x := Thing.Embedded{Name: "Barry"}
> fmt.Println(x.Thing.Name)
> // output:
> // Barry
> }
>
>
> Seems it would be useful to me to be able to do this sometimes, especially
> when consuming other people's code that uses embedded struct types.
>

A field is either named or anonymous. The later case means embedding. But
what a named embedded field would even stand for?

-- 

-j

-- 
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