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

Add code tabs for _tour/higher-order-functions #2525

Merged
merged 7 commits into from
Sep 16, 2022
Merged

Add code tabs for _tour/higher-order-functions #2525

merged 7 commits into from
Sep 16, 2022

Conversation

flomebul
Copy link
Contributor

No description provided.

@flomebul flomebul closed this Sep 15, 2022
@flomebul flomebul reopened this Sep 15, 2022

{% tabs map_example_1 class=tabs-scala-version %}

{% tab 'Scala 2' for=map_example_1 %}
Copy link
Member

Choose a reason for hiding this comment

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

surely this tab could be Scala 2 and 3? (scala 2 supports underscores in numeric literals)

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 have try, but it was refused by mdocstep (see 8e87cbb) if I understand well...

Copy link
Member

Choose a reason for hiding this comment

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

Right I didn't check the other commits, that's unfortunate, perhaps the mdoc configuration is outdated. However I'd still prefer to have 1 tab without the underscores - I don't think they are a fundamental improvement because at least for now our syntax highlighting doesn't support it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. If fact, mdoc look like to check with scala 2.12.4, that does not support such constant...
We just have to not use "mdoc". I will perform the change.


{% tabs map_example_2 class=tabs-scala-version %}

{% tab 'Scala 2' for=map_example_2 %}
Copy link
Member

Choose a reason for hiding this comment

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

same here, one tab please

Notice how `x` is not declared as an Int in the above example. That's because the
compiler can infer the type based on the type of function map expects (see [Currying](/tour/multiple-parameter-lists.html)). An even more idiomatic way to write the same piece of code would be:

{% tabs map_example_3 class=tabs-scala-version %}

{% tab 'Scala 2' for=map_example_3 %}
Copy link
Member

Choose a reason for hiding this comment

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

and here, you can have underscores in scala 2

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

Thanks!

@bishabosha
Copy link
Member

updated #2481

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.

2 participants