Skip to content

4.15. Method Syntax #22

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 16 commits into from
Feb 1, 2016
Merged

4.15. Method Syntax #22

merged 16 commits into from
Feb 1, 2016

Conversation

Nnwww
Copy link
Contributor

@Nnwww Nnwww commented Jan 27, 2016

Qiitaより移転。
暫定翻訳完了しました

  • variantsは「同じ種類のものだが、他と少し違うもの」という意味でkindと区別し「変形」と暫定訳
  • associated functionはTranslation Tableの訳そのまま「関連関数」と暫定訳
    • 「関連付いた関数」なども良いかもしれません
  • 最後の行(L.280)のコロンは詳述だと解釈してそのまま並べています

@Nnwww Nnwww changed the title [WIP] 4.15. Method Syntax 4.15. Method Syntax Jan 29, 2016
@Nnwww Nnwww changed the title 4.15. Method Syntax [WIP] 4.15. Method Syntax Jan 29, 2016
@Nnwww Nnwww changed the title [WIP] 4.15. Method Syntax 4.15. Method Syntax Jan 29, 2016
`self`, `&self`, and `&mut self`. You can think of this first parameter as
being the `foo` in `foo.bar()`. The three variants correspond to the three
kinds of things `foo` could be: `self` if it’s just a value on the stack,
`&self` if it’s a reference, and `&mut self` if it’s a mutable reference.
Because we took the `&self` parameter to `area`, we can use it just like any
other parameter. Because we know it’s a `Circle`, we can access the `radius`
just like we would with any other `struct`.
just like we would with any other `struct`. -->
メソッドに渡す特別な第1引数として、 `self` 、 `&self` 、 `&mut self` という3つの変形があります。 `foo.bar()` の第1引数は `foo` であると考えて下さい。3つの変形は `foo` が成り得る3種類の状態に対応しており、それぞれ `self` がスタック上の値である場合、 `&self` が参照である場合、 `&mut self` がミュータブルな参照である場合となっています。 `area` で `&self` を受け取っているため、他の引数と同じように扱えます。引数が `Circle` であるのは分かっていますから、他の `struct` でするように `radius` へアクセスできます。
Copy link
Member

Choose a reason for hiding this comment

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

foo.bar()の第1引数はfoo` であると考えて下さい

原文の"You can think of this first parameter as being the foo in foo.bar()."とはやや異なっているように感じます。
「第一引数はfoo.bar()に於けるfooと思って下さい」はどうでしょうか。

Copy link
Member

Choose a reason for hiding this comment

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

[nits]

area

area では」の方がやや読みやすいかと。

@KeenS
Copy link
Member

KeenS commented Jan 30, 2016

コメントしました。[WIP]を外したらpingを飛ばしていただけるとレビューが早くなります。

@KeenS
Copy link
Member

KeenS commented Jan 31, 2016

  • variantsは「同じ種類のものだが、他と少し違うもの」という意味でkindと区別し「変形」と暫定訳

variantsは例えば文字なら「異体字」などと訳されるのですが上手い和訳が思いつきませんね…。「変形」でいいと思います。

  • associated functionはTranslation Tableの訳そのまま「関連関数」と暫定訳

"associated ~"については"associated type"に「関連型」という定訳があるようなのでそこから援用しています。「関連関数」で良いと思います。

@Nnwww
Copy link
Contributor Author

Nnwww commented Feb 1, 2016

@KeenS レビューの反映完了しました、宜しくお願いします。
(特にレスポンスを返していないコメントは指摘通り取り込ませていただきました。)

@KeenS
Copy link
Member

KeenS commented Feb 1, 2016

長くかかってしましましたがお疲れさまでした。ありがとうございます。

KeenS added a commit that referenced this pull request Feb 1, 2016
@KeenS KeenS merged commit 73206a8 into rust-lang-ja:master Feb 1, 2016
@Nnwww
Copy link
Contributor Author

Nnwww commented Feb 1, 2016

@KeenS すみません、成果物のインデックスだと「メソッド構文」になっていました、私の訳のタイトルが「メソッドシンタックス」なので修正しなければなりません…

@KeenS
Copy link
Member

KeenS commented Feb 1, 2016

おや、本当ですね。軽微なので手元で修正します。

KeenS added a commit that referenced this pull request Feb 1, 2016
@Nnwww
Copy link
Contributor Author

Nnwww commented Feb 1, 2016

ありがとうございます。

@tatsuya6502 tatsuya6502 modified the milestone: 1.6 Apr 28, 2016
@Nnwww Nnwww deleted the 4_15_Method_Syntax branch August 9, 2016 06:06
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.

3 participants