Skip to content

Add section on dropping DelayedInit #2583

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

Merged
merged 5 commits into from
May 29, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 29, 2017

No description provided.

for benchmarking! Also, if you want to access the command line arguments,
you need to use an explicit `main` method for that.

object Hello extends App {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, is there any point in doing extends App?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, good catch.

@smarter
Copy link
Member

smarter commented May 29, 2017

See also #559 which lead to the creation dotty.runtime.LegacyApp.

@smarter
Copy link
Member

smarter commented May 29, 2017

/cc @olafurpg in case you weren't aware of it: #559

@odersky
Copy link
Contributor Author

odersky commented May 29, 2017

#559 does not seem to be an issue anymore, at least not for simple cases where we do not access args. I added a test.

@odersky odersky force-pushed the add-reference-2 branch from 97ebc45 to 28f2f23 Compare May 29, 2017 18:10
@odersky odersky merged commit ec92d30 into scala:master May 29, 2017
@smarter smarter mentioned this pull request May 29, 2017
@olafurpg
Copy link
Contributor

Thanks @smarter I opened scalacenter/scalafix#174 to handle the cases when args is accessed. Currently, that case compiles but args == null at runtime. What do you think about removing args to get a compile-time error instead?

https://github.com/lampepfl/scala/blob/7ecfce1fb8d39275f082aaa3ad4dc0eee197391c/src/library/scala/App.scala#L46

@smarter
Copy link
Member

smarter commented May 30, 2017

We can't really remove it because it comes from scala-library, and we don't recompile scala-library currently in dotty, we use the one from 2.11.11 as-is.

@olafurpg
Copy link
Contributor

I see, that makes sense @smarter

Dotty allows this only if `T` is a class type. The change was made because
unrestricted type projection is [unsound](https://github.com/lampepfl/dotty/issues/1050).

The restriction rule out the [type-level encoding of compbinator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/s/compbinator/combinator

@olafurpg
Copy link
Contributor

olafurpg commented Jun 8, 2017

We just added the Scalafix NoExtendsApp rewrite that replaces extends App with an explicit main function, regardless if args is used or not https://scalacenter.github.io/scalafix/#NoExtendsApp

@allanrenucci allanrenucci deleted the add-reference-2 branch December 14, 2017 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants