patch 9.1.1105: Vim9: no support for protected new() method
Problem: Vim9: no support for protected new() method
Solution: support the protected "_new()" object method
(Yegappan Lakshmanan)
closes: #16604
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt
index 9aab6c7..5e5c28e 100644
--- a/runtime/doc/vim9class.txt
+++ b/runtime/doc/vim9class.txt
@@ -1,4 +1,4 @@
-*vim9class.txt* For Vim version 9.1. Last change: 2024 Dec 29
+*vim9class.txt* For Vim version 9.1. Last change: 2025 Feb 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -272,6 +272,9 @@
When defining the new() method the return type should not be specified. It
always returns an object of the class.
+The new() method can be made a protected method by using "_new()". This can
+be used to support the singleton design pattern.
+
*E1386*
When invoking an object method, the method name should be preceded by the
object variable name. An object method cannot be invoked using the class