Hi Bram, 

Just to remember static meaning in C/C++ :
'' 
A static variable inside a function keeps its value between invocations ''. 
https://stackoverflow.com/questions/572547/what-does-static-mean-in-c/572550#572550

In C++ static class purpose is helper class and don't need to be 
instantiated. Furthermore, direct access to static member can be easily 
done as this :   MyHelper::myStaticMember

https://stackoverflow.com/questions/10442404/invoke-a-c-class-method-without-a-class-instance/10442432#10442432

Will it be same meaning  in vim9 class ? 
I think it should. 

N i c o l a s

Le dimanche 18 décembre 2022 à 14:33:24 UTC+1, Bram Moolenaar a écrit :

>
> You may have noticed I started implementing classes for Vim9 script.
> There are quite a few detailed choices to make. I have already written
> the documentation with the current ideas: ":help vim9class". But
> nothing is set in stone yet, we can discuss improvements.
>
> One thing where different languages have a different way of doing things
> is how object and class members are declared. Some are very verbose and
> offer detailed options for access, others are so concise it's hard to
> spot declarations and some have hardly any access control. For Vim9 the
> goal is to keep it simple, only support the features we really need, use
> a simple syntax.
>
> For object members most languages use the "this." prefix. But not
> everywhere, which makes it inconsistent. A good example is a
> constructor where object members that are also an argument need to be
> prefixed with "this." to avoid a name collision, while other object
> members are used without "this.". I find that very confusing. Example:
>
> SomeObject(String name)
> {
> this.name = name;
> gender = Gender.unknown;
> }
>
> Here both "name and "gender" are object members, but used differently,
> because "name" is also an argument.
>
> I looked into using the "this." prefix for object members everywhere,
> and that turns out to work very well. It's not really different from
> what other languages are doing, it's not a new mechanism. But instead
> of using it optionally, require using it everywhere makes it consistent.
>
> One thing I'm not yet sure about is the declaration. Currently it works
> like this:
>
> this.name: string
> this.gender: Gender
>
> Notice that there is no "var" keyword. It's not needed to recognize the
> declaration. I can't think of a good reason to add "var" here, other
> than that a declaration would be expected to always have "var". Well, I
> don't have that expectation.
>
> For class members most languages use the "static" keyword. It's a bit
> of a weird word, but I suppose most people are used to it, and I can't
> find a popular language that has a good alternative.
>
> If we leave out "var" for object members, I suppose we should also leave
> it out for class members. We then get:
>
> static oneClassMember: number
> static twoClassMember: string
>
> I think this looks fine. Any objections?
>
>
> -- 
> MORTICIAN: Bring out your dead!
> [clang]
> Bring out your dead!
> [clang]
> Bring out your dead!
> CUSTOMER: Here's one -- nine pence.
> DEAD PERSON: I'm not dead!
> The Quest for the Holy Grail (Monty Python)
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// \\\
> \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/e9b393cc-77b9-4eb6-85b4-da91cbfde2ean%40googlegroups.com.

Raspunde prin e-mail lui