patch 9.0.1031: Vim9 class is not implemented yet

Problem:    Vim9 class is not implemented yet.
Solution:   Add very basic class support.
This commit is contained in:
Bram Moolenaar
2022-12-08 15:32:33 +00:00
parent 038e6d20e6
commit 00b28d6c23
29 changed files with 1066 additions and 74 deletions

View File

@ -336,6 +336,9 @@ Defining a class ~
A class is defined between `:class` and `:endclass`. The whole class is
defined in one script file. It is not possible to add to a class later.
A class can only be defined in a |Vim9| script file. *E1315*
A class cannot be defined inside a function.
It is possible to define more than one class in a script file. Although it
usually is better to export only one main class. It can be useful to define
types, enums and helper classes though.
@ -369,9 +372,9 @@ A class can extend one other class.
*implements*
A class can implement one or more interfaces.
*specifies*
A class can declare it's interface, the object members and methods, with a
A class can declare its interface, the object members and methods, with a
named interface. This avoids the need for separately specifying the
interface, which is often done an many languages, especially Java.
interface, which is often done in many languages, especially Java.
Defining an interface ~
@ -634,7 +637,7 @@ directly writing you get an error, which makes you wonder if you actually want
to allow that. This helps writing code with fewer mistakes.
Making object membes private with an underscore ~
Making object members private with an underscore ~
When an object member is private, it can only be read and changed inside the
class (and in sub-classes), then it cannot be used outside of the class.