On Tuesday, 13 August 2019 17:03:36 UTC+2, jochen...@gmx.de wrote:
>
> type X Y is a type declaration, you have to cast between the types
> type X=Y is a type alias, where X can be used as Y without casting
>
There are no type cast in Go. Only type conversions.
V.
--
You received this message
type X Y is a type declaration, you have to cast between the types
type X=Y is a type alias, where X can be used as Y without casting
Am Dienstag, 13. August 2019 06:53:20 UTC+2 schrieb Sathish VJ:
>
> And what is the difference between each of these: type alias, type
> redefinition, type
On Tue, Aug 13, 2019 at 8:10 AM Sathish VJ wrote:
> So doing *type X Y* is just a type declaration then?
>
>
In a certain sense
type X Y
and
type X = Y
are both type declarations. They differ in that the first is generative,
whereas the other is a synonym. In a generative pattern, you
On Tuesday, 13 August 2019 09:43:05 UTC+2, Jan Mercl wrote:
>
> On Tue, Aug 13, 2019 at 9:24 AM Volker Dobler
> > wrote:
>
> > Yes, of course. It declares a new named type X, the underlying
> > type is Y which can be some predeclared type like int, some
> > other named declared type (like
On Tue, Aug 13, 2019 at 9:24 AM Volker Dobler
wrote:
> Yes, of course. It declares a new named type X, the underlying
> type is Y which can be some predeclared type like int, some
> other named declared type (like MyFooType) or a "type literal"
> (a term I made up) like struct{X,Y float64; T
On Tuesday, 13 August 2019 08:10:56 UTC+2, Sathish VJ wrote:
>
> So doing *type X Y* is just a type declaration then?
>
Yes, of course. It declares a new named type X, the underlying
type is Y which can be some predeclared type like int, some
other named declared type (like MyFooType) or a "type
So doing *type X Y* is just a type declaration then?
Meanwhile, I wrote a small example to help me figure out the differences
between some of these based on the specs. Leaving it here in case it is
useful for somebody.
package main
import "fmt"
type X struct {}
func (X) f() {}
type Y X //