> I notice that it's planned to allow classes to "specify" an interface.
> Does this not make interfaces themselves redundant?  I can't see any
> utility to them over abstract classes that specify an interface.

An abstract class and an interface have several similarities.  Some
languages do not even have interfaces and then you use an abstract class
instead.

An important difference is the intention.  For an abstract class this is
not always clear, some people suggest to not have them at all for that
reason.  For an interface the intention is very clear.

The idea to have a class (not abstract) specify an interface comes from
the life cycle of code.  Also for testing purposes.  Very often someone
creates a class, and only later there is a desire to have an interface,
which the class implements.  Since this then requires quite a bit of
refactoring, some have suggested to always define an interface and a
separate class that implements that interface.  Unfortunately that
causes a lot of duplication.

The mechanism that a class can function as an interface at the same time
solves these problems elegantly.  It avoids defining an interface
separately, and it's easy to add the interface to the class later.
It is almost like having a tool that generates the interface from the
class.

Only a few languages have this mechanism, but I like it.  We can
probably do without it for quite a while, thus implementing this has a
low priority.

-- 
>From "know your smileys":
 @:-()  Elvis Presley

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230205175434.D39E31C07B3%40moolenaar.net.

Raspunde prin e-mail lui