@@ -1073,8 +1073,11 @@ For ループ ~
10731073 special true または v:true
10741074 job 非 NULL
10751075 channel 非 NULL
1076- class 非 NULL
1077- object 非 NULL (TODO: isTrue() が true を返すとき)
1076+ class 該当なし
1077+ object 非 NULL
1078+ enum 該当なし
1079+ enum value 常時
1080+ typealias 該当なし
10781081
10791082真偽値演算子 "||" と "&&" は、値が真偽値、0 または 1 であることを期待する: >
10801083 1 || false == true
@@ -2350,11 +2353,12 @@ script と Vim9 script の両方で、辞書以外の値が必要なときに、
23502353 # あると推測する
23512354 map(mylist, (i, _) => $"item {i} ") # E1012: type mismatch...
23522355<
2353- The error occurs because `map ()` tries to modify the list elements to strings,
2354- which conflicts with the declared type.
2356+ このエラーは、 `map ()` がリスト要素を文字列に変更しようとし、宣言された型と衝突
2357+ するために発生する。
23552358
2356- Use | mapnew() | instead. It creates a new list, and Vim infers its type if it
2357- is not specified. Inferred and declared types are shown in this example: >vim9
2359+ 代わりに | mapnew() | を使用する。これは新しいリストを作成し、型が指定されていな
2360+ い場合は Vim がその型を推測する。推測された型と宣言された型は以下の例のとおり
2361+ である: >vim9
23582362
23592363 vim9script
23602364 var mylist = [0, 1]
@@ -2363,18 +2367,18 @@ is not specified. Inferred and declared types are shown in this example: >vim9
23632367 var declare: list<string> = mylist->mapnew((i, _) => $"item {i} ")
23642368 echo [declare, declare->typename()]
23652369<
2366- The key concept here is, variables with declared or inferred types cannot
2367- have the types of the elements within their containers change. However, type
2368- "changes" are allowed for either :
2369- - a container literal (not bound to a variable), or
2370- - a container where | copy() | or | deepcopy() | is used in method chaining.
2371- Both are demonstrated in this example : >vim9
2370+ ここで重要な概念は、宣言型または推論型を持つ変数では、コンテナ内の要素の型は変
2371+ 更できないということである。ただし、以下のいずれかの場合は型の "変更" が許容さ
2372+ れる :
2373+ - コンテナリテラル (変数に束縛されていない)、または
2374+ - メソッドチェーンで | copy() | または | deepcopy() | が使用されているコンテナ。
2375+ この例では、どちらも示されている : >vim9
23722376
23732377 vim9script
2374- # list literal
2378+ # 文字列のリスト
23752379 echo [1, 2]->map((_, v) => $"#{v} ")
23762380 echo [1, 2]->map((_, v) => $"#{v} ")->typename()
2377- # deepcopy() in a method chain
2381+ # メソッド チェーン内の deepcopy()
23782382 var mylist = [1, 2]
23792383 echo mylist->deepcopy()->map((_, v) => $"#{v} ")
23802384 echo mylist->deepcopy()->map((_, v) => $"#{v} ")->typename()
0 commit comments