On Monday, 26 December 2022 at 22:59:19 UTC+11 Bram Moolenaar wrote: 

> I think that makes it a static class "function", and not a class 
> "method". 
>
> That depends on how you define this. A method usually implicitily gets 
> an extra argument or is aware of its context. It does not necessarily 
> alwayw need to be an object. 
>
> Ahh OK, I see now.

> Bram, I think that the doco here is referring to a class "function", not 
> a 
> > class "method". It might be worth distinguishing between method and 
> > function in the doco? 
>
> If that makes it easier to understand. 
>
> The doco already uses both words, "*method*" and "*function*", in various 
places.  I know this topic is annoyingly semantic, but I wondered if there 
was meant to be a specific meaning for each word as they are used now, or 
are they used interchangeably?   Because... now seems like a good chance to 
define what these words should mean for vim9class -  I think it would help 
avoid confusion going forward.

In normal English, at least in the way I think anyway, is that "method" 
refers to details of the process, the steps how you do something, and 
"function" is more about the outcome or goal, or purpose of a thing, it is 
bigger picture.   So, my general English understanding of those terms 
doesn't seem very helpful for this discussion.!

While its true that I have heard both terms used interchangeably in 
computing, in all sorts of weird ways.  I also remember when learning OO in 
the 90's  being taught by "authority figures" that a "method" is a special 
type of "function" that is an object member.   So, in that sense, not all 
functions are methods, but all methods are functions.   But since I've just 
done some research now, I think that this might be more of an academic 
idea, and doesn't seem to be used consistently in official OO language 
specs, like Java and C++ etc.   Then the terminology seems to get re-mixed 
again with functional programming anyway.

Just food for thought, I got no sacred cows here :)

Another possibility occurred to me, that you could keep;  *function* and 
*endfunction*
That could still be used to always mean *static *functions - as that 
essentially does now already - I mean, because there was no such thing as 
object member methods in vimscript before classes were added. 
So, if you say *function* and *endfunction*, when defined inside a class, 
means a static function of that class.   You wouldn't need the word static 
for that.

Because... you now have the opportunity to add;  *method* and *endmethod* 
to define object member methods.   ie. instead of *def *and *enddef*.   I 
find *def *and *enddef *a bit too generic,  but that is just my opinion.  
 Again, this is relying on a certain meaning of the word *method*, which I 
dont think is uncommon, but as you said it doesn't necessarily always have 
that meaning either.  

If you did this then *static *wouldn't need to be used for functions or 
methods.   That would just leave *static* for variables.  And, I think "*s:*" 
is very close in meaning already to how I understand *static*, (it implies 
certain lifetime and accessibility), and so you could say that an *s:* 
variable, when declared inside a class definition, is a static variable.   

If you did these couple of things, then you wouldn't need to use the word "
*static*" anywhere.




-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/0f43d82f-a1f9-4b3b-8a96-5ea0ba2c4d3bn%40googlegroups.com.

Raspunde prin e-mail lui