Gold: entry point issue

Golang is case-sensitive, with “main” as the entry point. Main would be an invalid entry point. The official Golang compiler will fail the following code, however, Elements Gold compiler just passes without any complaints.

package GoTest

import "fmt"

func Main() {
    fmt.Println("hello, world")
}

The entry point for Go application is the main function in the main package as described in the specification:

A complete program is created by linking a single, unimported package called the main package with all the packages it imports, transitively. The main package must have package name main and declare a function main that takes no arguments and returns no value.>

func main() { … }

Program execution begins by initializing the main package and then invoking the function main . When that function invocation returns, the program exits. It does not wait for other (non-main) goroutines to complete.

I don’t see that as super problematic, as long as main works too?

@mh you are right “Main” works too. I am just being paranoid for Gold not being “canonical” …

I guess - since Gold will extend Golang anyway, accepting “Main” is really not a problem, or we can treat it as just part of the extension.

Anecdotally, this reminds me of Microsoft’s C++/CLI and all its extensions (bad or good) to ISO C++ to fit in .NET . Some really like it, and some not.

Yeah, our main goal is that all Go code will compile in Gold (mainly to be used from the four other languages, as Go and Gold are severely limited e.g. by lack of classes, for use as main language for most project types), not necessarily that all code you wrote in Gold will back-port to standard Go.