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

two or three paragraphs seem missed in _overviews/scala3-book/taste-methods.md #2680

Open
benluo opened this issue Jan 29, 2023 · 3 comments

Comments

@benluo
Copy link
Contributor

benluo commented Jan 29, 2023

After Line 131 in _overviews/scala3-book/taste-methods.md, there should be at least two paragraphs more.

@bishabosha
Copy link
Member

bishabosha commented Jan 30, 2023

Please could you describe more precisely what you mean? It doesn't appear to me that there is missing/deleted text. These two paragraphs are talking about the extension methods example snippet that immediately follows.

Do you mean that there is not enough text, and there should be more text dedicated to explaining other details about extension methods?

@benluo
Copy link
Contributor Author

benluo commented Jan 30, 2023

In Chinese version, file "_zh-cn/overviews/scala3-book/taste-methods.md" from line 154

如果没有IDE的帮助,那段代码可能很难阅读,但这个代码要明显得多:

{% tabs method_10 %}
{% tab 'Scala 2 and 3' for=method_10 %}

engage(
  speedIsSet = true,
  directionIsSet = true,
  picardSaidMakeItSo = true,
  turnedOffParkingBrake = false
)

{% endtab %}
{% endtabs %}

扩展方法

扩展方法 允许您向封闭类添加新方法。
例如,如果要将两个名为 helloaloha 的方法添加到 String 类中,请将它们声明为扩展方法:

{% tabs extension0 %}
{% tab 'Scala 3 Only' %}

extension (s: String)
  def hello: String = s"Hello, ${s.capitalize}!"
  def aloha: String = s"Aloha, ${s.capitalize}!"

"world".hello    // "Hello, World!"
"friend".aloha   // "Aloha, Friend!"

{% endtab %}
{% endtabs %}

But all these lines missed in English version.

@bishabosha
Copy link
Member

ah this makes more sense, thanks!

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 a pull request may close this issue.

2 participants