Skip to content

Address #1058: Document scalac compiler options. #1063

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 12 commits into from
Jun 21, 2018

Conversation

exoego
Copy link
Contributor

@exoego exoego commented May 1, 2018

This PR addresses #1058.

The metadata (YAML) and style (HTML/Markdown/SCSS) are separated, so that one can change look-and-feel easily.

Almost all descriptions are extracted from source and manually edited.

schema:
type: Boolean
description: "Warn when non-Unit expression results are unused."
note: "To reduce noises for common idiom, warning are suppressed if type of results are `this.type`."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This note is for scala/bug#10761

.definition-list dd {
margin-left: 2em;
}
.definition-list .deprecated {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hope someone polish these deprecated and note styles.


Those influencing to language semantics are likely to be deprecated in Scala 2.13 (see [scala/scala-dev#430](https://github.com/scala/scala-dev/issues/430)).

Some optimization-related options, e.g. `-opt:**` and `-opt-inline-form` are included in this section, since **REASON_HERE**.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found -opt:** and -opt-inline-form are in private settings (-ish) section for `-Y' in the source therefore put them in this section.

Is it OK to categorize -opt:** and -opt-inline-form as private settings?

Copy link
Member

Choose a reason for hiding this comment

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

yes I think so 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that should say -opt-inline-from, not -form

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added reason and fixed typo.

@jvican
Copy link
Member

jvican commented May 1, 2018

Wow, this is amazing work @exoego. How did you generate the yml file? Can that be done for future versions of Scala?

@exoego
Copy link
Contributor Author

exoego commented May 3, 2018

@jvican

I used a generator added in my fork of scala, which can be executed via sbt exporter/run.
It generetates YAML from the instance of scala.tools.nsc.Settings via reflection.

Can that be done for future versions of Scala?

I believe so, as this PoC-ish generator demonstrated.

Manual modification of several minutes are required, since the YAML file is supposed to contain extra useful information (such as why -Ywarn-value-discard does not warn on this.type) which are not written in the source code.

The generator is super quickie and dirty...
I will clean up under guidance with my pleasure 😄

@exoego exoego force-pushed the document-scalac-options branch from 7375ca2 to 3f5ea02 Compare May 3, 2018 00:47
@jvican jvican requested a review from SethTisue May 3, 2018 12:31
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

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

This looks great to me. Have you tried submitting a PR to scala/scala adding the exporter?

I like the idea of having all the scalac compiler options here. I propose that we also add the scala version that generated them, so that people don't expect it to be up-to-date with the latest release.

I think this already provides value as-is, so the automation of this process for every Scala relase could happen in another PR. I'm fine having slightly outdated compile options be online; changes to the options are unlikely and I think most people will see value in documenting them in our website. This is also good for Google searches.

I'm requesting the review of @SethTisue to complement my approval.

@SethTisue
Copy link
Member

(crazy busy lately, but I'll get to this)

@som-snytt
Copy link
Contributor

Someone needed this today. Also, -opt might need its own wiki...

@som-snytt
Copy link
Contributor

I don't know what the hang-up is, but someone needs this literally every day.

https://gitter.im/scala/scala?at=5b2b98d80168e70c08e067dc

@SethTisue SethTisue merged commit b627164 into scala:master Jun 21, 2018
@SethTisue
Copy link
Member

apologies. I should have merged this first and worried about maybe improving it further later.

thank you, @exoego! this looks great already.

@SethTisue
Copy link
Member

@som-snytt
Copy link
Contributor

That is a huge improvement over nothing! Of course, it's already out of date. But that just gives folks an excuse to head over to StackOverflow and ask a question and earn five points. In fact, I'm going over there now to ask what is -Xmixin-force-forwarders and when would I want to use it and does it have anything to do with World Cup?

@som-snytt
Copy link
Contributor

@SethTisue
Copy link
Member

publicized: https://twitter.com/scala_lang/status/1011334202883747844

@exoego exoego deleted the document-scalac-options branch January 31, 2019 06:31
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.

5 participants