Replies: 8 comments 10 replies
-
Yeah, I missed that section when I first looked at the docs. And there's also
|
Beta Was this translation helpful? Give feedback.
-
@mg979 As you've mentioned elsewhere, vim9script does not have properties and doesn't need that complexity. Having a member in an interface, could be considered as part of how that concept is handled. The fact that this doesn't appear in C# or go, and only in Java as constants, doesn't bother me. Vim is intended to be a scripting language but strongly typed and OOP capabilities (not to mention the very vim specific bits). To that end, the syntax of some concepts isn't identical. And there are performance considerations in how things are implemented. A point to consider is whether or not properties should be part of an interface. If so, how can that be best handled? At what cost... |
Beta Was this translation helpful? Give feedback.
-
Interesting, I can see that. One difference is that interface can't have a method implementation. (at least I'm assuming they can't). But that seems minor to me. It matters if you're refactoring. If you're using interfaces, then decide you want to add a property to the interface that's a problem. Which could argue for get rid of |
Beta Was this translation helpful? Give feedback.
-
Multiple inheritance is to be avoided, interfaces are generally used instead of it, but they only declare methods, not members. If I had to keep one of abstract classes and interfaces, I'd keep interfaces. But they shouldn't support members declaration. An interface should only mean |
Beta Was this translation helpful? Give feedback.
-
I mean conceptually, not implementation. Conceptually, to me, it seems properties should be part of an interface.
I agree that "how the classes calculate the surface is their own business". But a member named Maybe what you mean is that you would rather see
, instead of a member, in the interface and sacrifice the performance. |
Beta Was this translation helpful? Give feedback.
-
If instead by Anyway here we don't have this kind of properties so it doesn't apply. |
Beta Was this translation helpful? Give feedback.
-
Thanks for starting this. I haven't read through it yet, but before I forget Bram responded to one of my queries some time ago. https://groups.google.com/g/vim_dev/c/yYpFNUHdRho/m/UTFWOY5VAgAJ
|
Beta Was this translation helpful? Give feedback.
-
Sems to be resolved |
Beta Was this translation helpful? Give feedback.
-
(This deserves its own discussion, moved here from elsewhere)
@yegappan @chrisbra @dkearns
From @mg979
Speaking of interfaces, generally they only define methods, here they also allow members? It looks like another kind of inheritance that makes things much too complex, I'd say either make interface work as in go/c# (no data, just methods) if it's possible (and easy) or drop them.
From @errael
That's a different discussion, this one is about access control working, not language spec; let's not hijack this discussion. It's a good discussion to have, I don't see anything in the spec about interface members, maybe they're not needed. BTW, vim9script doesn't support multiple inheritance, so can't just drop them.
From @mg979
In the documentation there's only one example with a method, but the examples here show you can define members. I can't see the difference from abstract classes this way.
It seems the vim9script class has been inspired by java classes, but also there interfaces can't define instance members, only constants (that aren't supported here).
Beta Was this translation helpful? Give feedback.
All reactions