> On 22/12/25 1:07 PM, Bram Moolenaar wrote:
> >> With 9.0.1094, in the script that follows, attempting to read a
> >> classMember through an instance fails;
> >>
> >> echomsg c.classMember
> >>
> >> should it?
> > No, an object does not provide a class member.
> >
> >> I suppose requiring the class name makes it most clear, but I recall
> >> mention that classnames can get long. I suppose a getter could be added.
> > How can you access the getter without referring to the class?
>
>
> Assuming c is an object
>
> c.GetClassMember()
>
> where the method GetClassMember() returns the classMember that was
> declared static.
Well, you can add such a method if you like, but it would not be added
automatically.
> >> Can a class method (or should it be called class function?) be static?
> > Nothing *is* static, the "static" keyword is used to change the meaning
> > of items.
>
> I should have said "can a method/function defined in a class be declared
> static?"
>
> One way to look at it: is it the case that any method can be invoked as
>
> MyClass.SomeMethod()
>
> and as long as "SomeMethod()" doesn't reference a variable like
> "this.someVar" then it's OK?
You need to explicitly declare a method as a class method or object
method. A class method is declared with "static". AFAIK all languages
do it this way.
--
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
ONE KNIGHT: Ni!
OTHERS: Sh!
ONE KNIGHT: (whispers) Sorry.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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/20221226115913.42A811C0AA4%40moolenaar.net.