Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions doc/vim9class.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*vim9class.txt* For Vim バージョン 9.1. Last change: 2025 Jul 24
*vim9class.txt* For Vim バージョン 9.1. Last change: 2025 Aug 27


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -276,7 +276,7 @@ new() メソッドは、"_new()" を使用して protected メソッドにする

3. クラス変数とメソッド *Vim9-class-member*

*:static* *E1337* *E1338* *E1368*
*:static* *E1329* *E1337* *E1338* *E1368*
クラスメンバは "static" で宣言される。これらは、定義されているクラス内でプリ
フィックスなしの名前によって使用される: >

Expand Down Expand Up @@ -510,12 +510,18 @@ const 変数はインターフェイスではサポートされていない。
<
抽象クラスの静的メソッドを抽象メソッドにすることはできない。

*E1404*
インターフェイスメソッドは抽象メソッドにすることはできない。

*E1373*
抽象クラスを拡張する非抽象クラスは、すべての抽象メソッドを実装する必要がある。
シグネチャ (引数、引数の型、戻り値の型) はまったく同じである必要がある。メソッ
ドの戻り値の型がクラスの場合、そのクラスまたはそのサブクラスの 1 つを拡張メソッ
ドで使用できる。

*E1431*
抽象スーパークラス内の抽象メソッドは呼び出すことができない。

==============================================================================

5. インターフェイスを使う *Vim9-using-interface*
Expand Down Expand Up @@ -634,6 +640,7 @@ Shape, Square および Triangle を使用した上記の例は、オブジェ

オブジェクト変数の初期化 ~

*E1430*
変数の型がクラスで明示的に指定されていない場合、クラス定義時に "any" に設定さ
れる。オブジェクトがクラスからインスタンス化されると、変数の型が設定される。

Expand Down Expand Up @@ -946,9 +953,9 @@ Note メソッド名は "new" で始まる必要があることに注意。"new(
Green, Blue, Black
endenum
<
*enumvalue* *E1422*
*enumvalue* *E1422* *E1428*
列挙値はコンマで区切られる。複数の列挙値を 1 行にリストできる。最後の列挙値の
後にコンマを付けてはならない。
後にコンマを付けてはならない。重複した列挙値は許可されない。

列挙値には、列挙名に続いて値の名前を使用してアクセスする: >

Expand Down Expand Up @@ -1008,7 +1015,7 @@ Note メソッド名は "new" で始まる必要があることに注意。"new(
列挙型とその値は不変である。数値型または文字列型として使用することはできない。
列挙値は変更可能なインスタンス変数を宣言できる。

*enum-name*
*enum-name* *E1427*
各列挙値オブジェクトには、列挙値の名前を含む "name" インスタンス変数がある。こ
れは読み取り専用の変数である。

Expand Down
17 changes: 12 additions & 5 deletions en/vim9class.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*vim9class.txt* For Vim version 9.1. Last change: 2025 Jul 24
*vim9class.txt* For Vim version 9.1. Last change: 2025 Aug 27


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -282,7 +282,7 @@ name.

3. Class Variables and Methods *Vim9-class-member*

*:static* *E1337* *E1338* *E1368*
*:static* *E1329* *E1337* *E1338* *E1368*
Class members are declared with "static". They are used by the name without a
prefix in the class where they are defined: >

Expand Down Expand Up @@ -515,12 +515,18 @@ prefix when defining the method: >
<
A static method in an abstract class cannot be an abstract method.

*E1404*
An interface method cannot be an abstract method.

*E1373*
A non-abstract class extending the abstract class must implement all the
abstract methods. The signature (arguments, argument types and return type)
must be exactly the same. If the return type of a method is a class, then
that class or one of its subclasses can be used in the extended method.

*E1431*
An abstract method in an abstract super class cannot be invoked.

==============================================================================

5. Using an interface *Vim9-using-interface*
Expand Down Expand Up @@ -637,6 +643,7 @@ object variable name used in a super class cannot be reused in a child class.

Object Variable Initialization ~

*E1430*
If the type of a variable is not explicitly specified in a class, then it is
set to "any" during class definition. When an object is instantiated from the
class, then the type of the variable is set.
Expand Down Expand Up @@ -959,10 +966,10 @@ An enum is a type that can have one of a list of values. Example: >
Green, Blue, Black
endenum
<
*enumvalue* *E1422*
*enumvalue* *E1422* *E1428*
The enum values are separated by commas. More than one enum value can be
listed in a single line. The final enum value should not be followed by a
comma.
comma. Duplicate enum values are not allowed.

An enum value is accessed using the enum name followed by the value name: >

Expand Down Expand Up @@ -1021,7 +1028,7 @@ The following example shows an enum with object variables and methods: >
Enums and their values are immutable. They cannot be utilized as numerical or
string types. Enum values can declare mutable instance variables.

*enum-name*
*enum-name* *E1427*
Each enum value object has a "name" instance variable which contains the name
of the enum value. This is a readonly variable.

Expand Down