Skip to content
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

Can the SSA optimizer cross packages? #22672

Closed
petar opened this issue Nov 11, 2017 · 1 comment
Closed

Can the SSA optimizer cross packages? #22672

petar opened this issue Nov 11, 2017 · 1 comment

Comments

@petar
Copy link
Contributor

petar commented Nov 11, 2017

What version of Go are you using (go version)?

1.9

Does this issue reproduce with the latest release?

Yes.

Consider a chain of functions that call each other:

func f1(x X) { ... f2(y) ... }
func f2(y Y) { ... f3(z) ... }
and so on.

Assume also that their arguments and returns values are static Go types (no interfaces).

Generally, such a chain of statically-typed invocations will fall within the domain of the SSA optimizer and will be rewritten (theoretically) optimally.

The issue arises when the invocation chain is recursive, e.g.

func f1(x X) { ... f2(y) ... }
func f2(y Y) { ... f3(z) ... }
func f3(z Z) { ... f1(x) ... }

and the user desires to implement f1 and f3 in different packages.

This is not possible due to the design of the packaging system
(because the packages of f1 and f3 would have to import each other).

Consequently, large amounts of recursive code cannot be spread across packages.

This situation has arisen in practice, so I wonder what the language designers would advise.

Thank you.

@davecheney
Copy link
Contributor

Thank you for raising this issue. Unlike many projects on GitHub, the Go project does not use its bug tracker for general discussion or asking questions. We only use our bug tracker for tracking bugs and tracking proposals going through the Proposal Process.

Please see https://golang.org/wiki/Questions for good places to ask questions.

@golang golang locked and limited conversation to collaborators Nov 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants