Ah, okay, that is different then. What's the advantage of creating a new 
method versus copying the fields? I would imagine there is a penalty with 
each deference you have to follow in order to make that work.


I'm not familiar with Scala, so sorry if I'm telling you something you 
> know, but in go the member variables and methods are not copied over. The 
> Unicycle struct in go does not itself have those fields, the fields of the 
> struct do. In other words, defining
>
> type Unicycle struct {
>     Frame
>     Wheel
>     Seat
> } 
>
> Is exactly like declaring 
>
> type Unicycle struct {
>    Frame Frame
>    Wheel Wheel
>    Seat    Seat
> } 
>
> except that in the former case one can call unicycle.Cushiness() , and in 
> the latter one must call unicycle.Seat.Cushiness(). In particular, if you 
> swap out one Frame in the unicycle for a different Frame, the field values 
> change (the methods won't, since methods are with a type).
>

Reply via email to