@@ -2658,14 +2658,14 @@ Tuple と関数 (または部分関数) は様々な方法で宣言できる。|
26582658| variadic-tuple | 、および | vim9-func-declaration | を参照。
26592659
26602660 *null-compare*
2661- For familiar null compare semantics, where an empty container is not equal to
2662- a null container, do not use null_<type> in a comparison. That is because,
2663- in Vim9 script, although null_<type> == `null` , comparing an :
2661+ 空のコンテナと null コンテナが等しくないという、おなじみの null 比較セマンティ
2662+ クスでは、比較に null_<type> を使用してはならない。これは、Vim9 script では
2663+ null_<type> == `null` であっても、以下の比較が成立するからである :
26642664
2665- - empty container to `null` is `false` , but
2666- - empty container to null_<type> is `true` .
2665+ - 空のコンテナを `null` にすると `false` だが、
2666+ - 空のコンテナを null_<type> にすると `true` になる。
26672667
2668- So, compare against `null` , not null_<type> . For example : >vim9
2668+ したがって、 null_<type> ではなく `null` と比較すること。例 : >vim9
26692669
26702670 vim9script
26712671 var bonds: dict<list<string> > = {g: ['007', '008'], o: ['007', '009']}
@@ -2681,80 +2681,80 @@ So, compare against `null`, not null_<type>. For example: >vim9
26812681 echo result->empty() ? $"No matches for '{C} '" : $"{result} "
26822682 endif
26832683<
2684- NOTE: Using "result == null_list" instead of "result == null" would
2685- fail to distinguish the error (nothing entered) and the valid
2686- (nothing matched) result because [] == null_list whereas
2687- [] != null.
2684+ NOTE: "result == null" の代わりに "result == null_list" を使用する
2685+ と、[] != null であるのに対し [] == null_list であるため、エ
2686+ ラー (何も入力されていない) と有効な結果 (何も一致していない)
2687+ を区別できなくなる。
26882688
2689- Conceptually, think of the null_<type> construct as a hybrid/bridge between
2690- the general `null` and typed ` empty ` containers, having properties of both.
2691- In the following section there are details about comparison results.
2689+ 概念的には、 null_<type> 構文は、汎用的な `null` と型付きの ` empty ` コンテナと
2690+ の中間に位置するハイブリッド/ブリッジのようなものと考えるとよく、両者の性質を
2691+ 併せ持っている。比較結果の詳細については、以下の節で説明する。
26922692
26932693 *null-details* *null-anomalies*
2694- This section describes issues about using null and null_<type> ; included below
2695- are the enumerated results of null comparisons. In some cases, if familiar
2696- with vim9 null semantics, the programmer may choose to use null_<type> in
2697- comparisons and/or other situations.
2694+ このセクションでは、 null と null_<type> の使用に関する問題について説明する。以
2695+ 下に、null 比較の列挙結果を示す。場合によっては、vim9 の null のセマンティクス
2696+ に精通しているプログラマは、比較やその他の状況で null_<type> を使用することを
2697+ 選択する場合がある。
26982698
2699- Elsewhere in the documentation it says, "often a null value is handled the
2700- same as an empty value, but not always". For example, you cannot add to a
2701- null container : >vim9
2699+ ドキュメントの別の箇所では、"多くの場合、 null 値は空の値と同じように扱われる
2700+ が、常にそうとは限らない」と書かれている。例えば、null コンテナにデータを追加
2701+ することはできない : >vim9
27022702
27032703 vim9script
27042704 var le: list<any> = []
2705- le->add('Okay') # le is now ['Okay']
2705+ le->add('Okay') # le は ['Okay']
27062706 var ln = null_list
27072707 ln->add("E1130") # E1130: Cannot add to null list
27082708<
2709- As explained in | null-compare | , there is a non-transitive relationship among
2710- `null` , null_ <type> containers, and ` empty ` . To recap, for example : >vim9
2709+ | null-compare | で説明したように、 `null` 、null_ <type> コンテナ、 ` empty ` の間に
2710+ は非推移的な関係がある。まとめると、例えば以下のようになる : >vim9
27112711
27122712 vim9cmd echo (null_dict == {}, null_dict == null, {} != null)
27132713<
2714- The exception is an uninitialized string. It is equal to `null` (and is the
2715- same instance as `null_string` ). The 'is' operator ( | expr-is | ) may be used to
2716- determine whether a string is uninitialized : >vim9
2714+ 例外は未初期化の文字列である。これは `null` と等しく ( `null_string` と同じイン
2715+ スタンスである)。文字列が未初期化かどうかを判断するには、 'is' 演算子
2716+ ( | expr-is | ) を使用できる : >vim9
27172717
27182718 vim9script
27192719 var s: string
27202720 echo s == null_string # true
2721- echo s is null_string # true (the same instance )
2722- echo s == null # true (unexpected, perhaps )
2723- echo s is null # false (not the same instance )
2721+ echo s is null_string # true (同じインスタンス )
2722+ echo s == null # true (意外かもしれない )
2723+ echo s is null # false (同じインスタンスではない )
27242724<
2725- However, don't do the same for the other containers because, when evaluated
2726- against their applicable null_ <type> with 'is' , they return `false` : >vim9
2725+ ただし、他のコンテナについては同じことを行ってはならない。対応する null_ <type>
2726+ に対して 'is' で評価すると、 `false` が返されるためである : >vim9
27272727
27282728 vim9script
27292729 var d: dict<any>
27302730 echo d == null_dict # true
2731- echo d is null_dict # false (not the same instance )
2732- echo d == null # false (as expected )
2733- echo d is null # false (not the same instance )
2731+ echo d is null_dict # false (同じインスタンスではない )
2732+ echo d == null # false (期待通り )
2733+ echo d is null # false (同じインスタンスではない )
27342734<
2735- The key distinction here is an uninitialized string is implemented as
2736- `null_string` , while an uninitialized list, dict, tuple, or blob is
2737- implemented as an empty container ([], {}, (), and 0z respectively).
2738- So, those uninitialized types are equal to, but not the same instance as,
2739- their null_<type> counterparts, as this example shows : >vim9
2735+ ここでの重要な違いは、初期化されていない文字列は `null_string` として実装され
2736+ るのに対し、初期化されていないリスト、辞書、 tuple、または blob は空のコンテナ
2737+ (それぞれ []、{}、()、および 0z) として実装されることである。
2738+ したがって、これらの初期化されていない型は、以下の例に示すように、対応する
2739+ null_<type> と同等であるが、同じインスタンスではない : >vim9
27402740
27412741 vim9script
27422742 var t: tuple<any>
27432743 echo t == null_tuple # true
27442744 echo t is null_tuple # false
27452745
2746- However, a variable initialized to the null_<type> is equal not only to the
2747- null_ <type> , it is also equal to null. For example : >vim9
2746+ ただし、null_ <type> に初期化された変数は、 null_<type> と等しいだけでなく、null
2747+ とも等しくなる。例 : >vim9
27482748
27492749 vim9script
27502750 var t: tuple<any> = null_tuple
27512751 echo t == null_tuple # true
27522752 echo t is null_tuple # true
27532753 echo t == null # true
27542754<
2755- An uninitialized container variable is not equal to null, except for an
2756- uninitialized string, which is explained in an example, above. So, these
2757- all echo `true` : >vim9
2755+ 初期化されていないコンテナ変数は、上記の例で説明したように、初期化されていない
2756+ 文字列を除き、null と等しくない。したがって、以下の式はすべて `true` を表示す
2757+ る : >vim9
27582758
27592759 vim9script
27602760 var b: blob | echo b != null
@@ -2763,7 +2763,8 @@ all echo `true`: >vim9
27632763 var t: tuple<any> | echo t != null
27642764 var s: string | echo s == null
27652765
2766- An uninitialized specialized variable is equal to null so these all echo `true` : >vim9
2766+ 初期化されていない特殊変数は null に等しいため、これらはすべて `true` を表示す
2767+ る: >vim9
27672768
27682769 vim9script
27692770 var c: channel | echo c == null
@@ -2776,11 +2777,11 @@ An uninitialized specialized variable is equal to null so these all echo `true`:
27762777 endenum
27772778 var ne: Enum | echo ne == null
27782779<
2779- Note: the specialized variables, like job, default to null and
2780- no specialized variable has a corresponding empty value.
2780+ Note: job のような特殊な変数はデフォルトで null に設定され、対応する
2781+ 空の値を持つ特殊な変数はない。
27812782
2782- A container variable initialized to empty equals null_<type> , so these are all
2783- `true` : >vim9
2783+ 空に初期化されたコンテナ変数は null_<type> に等しいため、これらはすべて `true`
2784+ になる : >vim9
27842785
27852786 vim9script
27862787 var s: string = "" | echo s == null_string
@@ -2789,8 +2790,8 @@ A container variable initialized to empty equals null_<type>, so these are all
27892790 var t: tuple<any> = () | echo t == null_tuple
27902791 var d: dict<any> = {} | echo d == null_dict
27912792<
2792- However, a container variable initialized to empty does not equal null, so
2793- these are all `true` : >vim9
2793+ ただし、空に初期化されたコンテナ変数は null と等しくないため、これらはすべて
2794+ `true` になる : >vim9
27942795
27952796 vim9script
27962797 var s: string = "" | echo s != null
0 commit comments