-
Notifications
You must be signed in to change notification settings - Fork 530
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
ioMain
annotation for blazing fast getting started experience (Scala 3.2+)
#3149
Comments
This is great! I would bikeshed a bit on the annotation itself (the camel case looks super ugly to me), but I love the concept and it absolutely scratches the buzzword itch. |
Yep, name is not great - If CE was on Scala 3.2.0, then we could've just put the annotation in CE and iterate aggressively on it - it cannot be used anywhere outside of experimental scope, so it's a conscious decision by the users to use something that can break. Also apparently MiMa has support for ignoring annotated scopes (some of them), i.e. it's used in Dotty: https://github.com/lampepfl/dotty/pull/14976/files#diff-539d15a8d5ba9a01a1724604b56cadf6851c57ec68dcf75a5073b6255d182de7R443 If the mythical 3.4.0 is indeed true, as the elders prophecised, we could just pop a simple |
I think we should add this to 3.4.0 and not worry about bincompat. The whole point of bincompat is for libraries. Libraries typically don't have |
What about |
I like it. Taking it further - |
Then should it be |
It's like Daniel knew that people would have opinions on names for things! |
I'd stick with |
I don't mind this, though I had another idea, which was |
This might be dangerous with a |
top-level cats-effect (+std) import is the only way to live. After thinking long and hard, I think I like |
I'm just leaving this here: https://github.com/typelevel/cats-effect-main 😇 It might sound obvious, but we might want to add some validation here: def command(info: Info, args: Seq[String]): Option[Seq[String]] = Some(args) As invoking the app w/o the correct arguments raises a variety of different exceptions, like:
or
|
I would like to take a crack at this @samspills |
That's awesome!! I'll assign you :D |
There's this repo ready for it :) https://github.com/typelevel/cats-effect-main |
@yisraelU sadly this annotation got removed here: scala/scala3#19937 but there's a SIP about MacroAnnotations to replace it: scala/improvement-proposals#80. |
@TonioGela |
How'd you like them buzzwords.
Scala 3.2 added an experimental support for custom
@main
annotations, see here: https://dotty.epfl.ch/docs/reference/experimental/main-annotation.html#It would be excellent to experiment with a
@ioMain
annotation (or even@io
?) in Cats Effect or any auxiliary project.I went ahead and wrote a demonstrator to hwet your appetite:
Run this program with Scala CLI:
Once the annotation design exits
experimental
phase, users should just be able to doAnd enjoy that deliciously non-invasive experience.
The text was updated successfully, but these errors were encountered: