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

Support multiple main methods in scripts #3498

Open
tgodzik opened this issue Feb 14, 2025 · 2 comments
Open

Support multiple main methods in scripts #3498

tgodzik opened this issue Feb 14, 2025 · 2 comments
Labels
enhancement New feature or request legacy:runner:compat Issues tied to the legacy scala runner compatibility priority: low scripting Issues tied to *.sc script inputs.

Comments

@tgodzik
Copy link
Member

tgodzik commented Feb 14, 2025

Is your feature request related to a problem? Please describe.
After #3479 (comment) we will detect single main class if it's the only thing contained in the script and invoke that.

Describe the solution you'd like
We should also allow user to define which main class to use if there is more that one for example:

object Main { def main(args: String): Unit = ??? }
object Main2 { def main(args: String): Unit = ??? }

Describe alternatives you've considered
Using .scala files is a very simple workaround

@tgodzik tgodzik added the enhancement New feature or request label Feb 14, 2025
@Gedochao Gedochao added scripting Issues tied to *.sc script inputs. legacy:runner:compat Issues tied to the legacy scala runner compatibility priority: low labels Feb 14, 2025
@SethTisue
Copy link
Contributor

I don't get the motivation for this. I've never used a scripting language where scripts have multiple entry points. If you want the same script to do different things, you accept command line options.

@tgodzik
Copy link
Member Author

tgodzik commented Feb 14, 2025

Yeah, I think we might never actually do it unless someone really needs it. This is more of a description of limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request legacy:runner:compat Issues tied to the legacy scala runner compatibility priority: low scripting Issues tied to *.sc script inputs.
Projects
None yet
Development

No branches or pull requests

3 participants