@main: Type-Based Program Execution

The proposal is deliberately a bit hand-wavy on this point, since it will be up to a future proposal to determine the exact mechanism that we use here. I think the options that we've seen so far for both issues are to have a compiler-blessed set of entry point methods, or to use an attribute like Joe's @entryPoint suggestion to designate a main method as having a specific symbol name. I really like that suggestion, which does let us keep both the entry point implementation and information about which signature it's using entirely in the library.

I'll include a summary of all this in the revised proposal — thanks!

Thanks @nnnnnnnn. I think that we should still record the original suggestion as well that @Joe_Groff improved upon - having the option to just have those options (with default values) be part of the @main attribute.

Using the attributes for the entry point do solve the issue and reduce the need to to modify the compiler to support new environments (that is make this more flexible). It also impacts the signature that @main sees, so I think that this should be part of the pitch.

Do you think you could include an example of an alternate signature in the documentation to help illustrate the usage?

Thinking about it more, I like the idea of an open-ended @entryPoint attribute that can specify an arbitrary symbol name, function signature, and calling convention, because it keeps the language design distinct from any platform-specific details, and also potentially makes the feature usable for non-standard entry points such as for plugins, or other past or future platforms with their own idiosyncratic process entry point behavior.

Terms of Service

Privacy Policy

Cookie Policy