Replies: 5 comments 11 replies
-
Here's some additional things I hope find their way into vim9class. @ychin mentioned that
It's probably important to know if the above is a correct statement
These types are primarily containers; in contrast, some of the builtin functions are applicable to any type. Some of the builtin functions throw an exception if not used with the proper type, for example
Here are some things in particular that might be useful
With these the following becomes possible
It would be nice if some builtin types, e.g. list or dict, acted like class/object, for example as though they implement __Container; and could do |
Beta Was this translation helpful? Give feedback.
-
I don't understand what drove this particular implementation but it seems to me the natural approach is a common base class and interfaces. I'd strongly prefer it wasn't added as another unnecessary mechanism.
Why are they designed in this manner? |
Beta Was this translation helpful? Give feedback.
-
It does feel a little confusing. IIUC, the main issue is getting vim9class to interoperate with existing vim builtins and objects. Containers, like
It's been pointed out that So these questions seem most important
Something like "common base class" is an implementation issue. |
Beta Was this translation helpful? Give feedback.
-
Petition to change "dunder methods" to "dundar methods". |
Beta Was this translation helpful? Give feedback.
-
Yes. That's how most similar languages work.
Simplicity, elegance, type-safety, normalcy and familiarity. The language already provides all the features needed to implement this. Why add extra compiler magic? Add features common to all classes to a parent base class, any, and provide plain modules with classes/interfaces for anything else.
I don't understand why they should be differentiated but even if you want to mark them as special I see no reason why they can't otherwise be used like anything else. |
Beta Was this translation helpful? Give feedback.
-
Here are some points from @yegappan
We need to extend these to classes.
Dunder methods are first addressed in #13238. Their usage will evolve, use this discussion to weigh in.
Beta Was this translation helpful? Give feedback.
All reactions