[neomutt-devel] To fork or not to fork?

Guyzmo z+mutt+neomutt at m0g.net
Thu Jan 26 14:09:11 CET 2017


On Thu, Jan 26, 2017 at 01:02:48PM +0100, toogley at mailbox.org wrote:
> >   * "Object Orientedness"..
> >     dkc:  all mailbox implement the same set of functions, defined in
> >           struct mx_ops, that way we can have generic code in mx.c that doesn't
> >           care about underlying implementation, it just calls the open, open_msg,
> >           close_msg, close callbacks on a mailbox to open a message
> >           it's mainly for code maintanability, not for speed
> 
> Would it a sensible idea to use lua for that purpose?
> https://en.wikipedia.org/wiki/Lua_%28programming_language%29#Object-oriented_programming

not really, it's possible to implement a pretty decent object oriented
paradigm in pure C, when it matter. 

Actually, the way it's currently implemented /is/ an OO design pattern,
the Strategy Pattern¹, where you've got the `struct mx_ops` acting like
an interface, each mailbox specialisation implementing that interface by
assigning function pointers callbacks. It's just done without any
syntactic sugar and type safety, like the ones provided by C++ classes.

That does not mean we shouldn't expose that API to Lua, so that we can
create a new mailbox specialisation in plugins, and have mutt use it like it
was native code. That would make it easier to add support to some exotic
mailboxes.

That being said, it does not mean that some features currently
implemented as patches could be removed from the code base and extracted
as lua extensions. The good rule of thumb for that would be to assess
smartly what's bloating the code, and wouldn't take a performance hit by
going at a higher level.

[1]:http://www.oodesign.com/strategy-pattern.html

-- 
Guyzmo


More information about the neomutt-devel mailing list