New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitor Alias Experiment #27

Open
bradleyfalzon opened this Issue Oct 4, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@bradleyfalzon
Owner

bradleyfalzon commented Oct 4, 2016

This may have far reaching consequences, or may not at all.

There's at least appears to be added ast.AliasSpec.

See CLs related to golang/go#16339

@bradleyfalzon bradleyfalzon added the bug label Oct 4, 2016

@bradleyfalzon bradleyfalzon added this to the v1.0.0 milestone Oct 4, 2016

@bradleyfalzon bradleyfalzon added enhancement and removed bug labels Oct 4, 2016

@bradleyfalzon

This comment has been minimized.

Show comment
Hide comment
@bradleyfalzon

bradleyfalzon Oct 29, 2016

Owner

https://tip.golang.org/ref/spec#Alias_declarations

Alias declarations

An alias declaration binds an identifier, the alias, to a constant, type, variable, or function denoted by a qualified identifier and declared in a different package.

AliasSpec = identifier "=>" QualifiedIdent .

The effect of referring to a constant, type, variable, or function by an alias is indistinguishable from referring to it by its original name. For example, the type denoted by a type alias and the aliased type are identical.

An alias declaration may appear only as a form of constant, type, variable, or function declaration at the package level, and the aliased entity must be a constant, type, variable, or function respectively. Alias declarations inside functions are not permitted.

const (
    G  =  6.67408e-11      // regular and alias declarations may be grouped
    Pi => math.Pi          // same effect as: Pi = math.Pi
)

type Struct => types.Struct    // re-export of types.Struct

func sin => math.Sin           // non-exported shortcut for frequently used function

An alias declaration may not refer to package unsafe.

Owner

bradleyfalzon commented Oct 29, 2016

https://tip.golang.org/ref/spec#Alias_declarations

Alias declarations

An alias declaration binds an identifier, the alias, to a constant, type, variable, or function denoted by a qualified identifier and declared in a different package.

AliasSpec = identifier "=>" QualifiedIdent .

The effect of referring to a constant, type, variable, or function by an alias is indistinguishable from referring to it by its original name. For example, the type denoted by a type alias and the aliased type are identical.

An alias declaration may appear only as a form of constant, type, variable, or function declaration at the package level, and the aliased entity must be a constant, type, variable, or function respectively. Alias declarations inside functions are not permitted.

const (
    G  =  6.67408e-11      // regular and alias declarations may be grouped
    Pi => math.Pi          // same effect as: Pi = math.Pi
)

type Struct => types.Struct    // re-export of types.Struct

func sin => math.Sin           // non-exported shortcut for frequently used function

An alias declaration may not refer to package unsafe.

@bradleyfalzon

This comment has been minimized.

Show comment
Hide comment
@bradleyfalzon

bradleyfalzon Nov 4, 2016

Owner

It appears that aliases won't be implemented by 1.8 anymore: golang/go#16339 (comment)

Owner

bradleyfalzon commented Nov 4, 2016

It appears that aliases won't be implemented by 1.8 anymore: golang/go#16339 (comment)

@dmitshur

This comment has been minimized.

Show comment
Hide comment
@dmitshur

dmitshur Nov 7, 2017

They've been implemented as "type aliases" in Go 1.9:

https://golang.org/doc/go1.9#language

dmitshur commented Nov 7, 2017

They've been implemented as "type aliases" in Go 1.9:

https://golang.org/doc/go1.9#language

@bradleyfalzon

This comment has been minimized.

Show comment
Hide comment
@bradleyfalzon

bradleyfalzon Nov 16, 2017

Owner

Thanks for the reminder, and this should've been implemented a while ago. It's back on my radar, I've looked at it before and it appeared straightforward.

Owner

bradleyfalzon commented Nov 16, 2017

Thanks for the reminder, and this should've been implemented a while ago. It's back on my radar, I've looked at it before and it appeared straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment