[neomutt-devel] Fwd: Re: which language for object orientation? Was: To fork or not to fork?

guyzmo z+mutt+neomutt at m0g.net
Thu Jan 26 19:43:23 CET 2017

On Thu, Jan 26, 2017 at 06:15:32PM +0100, toogley at mailbox.org wrote:
> Hm, sorry. I keep forgetting that i have to reply to the group...

press `L` to answer to the list (or rebind it)

> […] If C and lua have the same abilities of implementing OO but lua
> would have the better type system - i would suggest using lua for
> impmententing OO.
> For Example: As far as i understand is, among other things, C weakly
> typed because it provides very few protections of e.g. buffer
> overflows and such. I'm not sure if lua is better in that regard?

Well, generally speaking you're right Lua has many advantages over C,
which is why it's an interesting language to use. But you forget to
factor in other things that makes Lua a worst candidate than C to
implement an application such as Mutt.

What's great and awful at the same time with C is that you're
working at a very low level, where you're directly managing memory
usage, where your code is compiled, normalised and optimised so it has
very little overhead when ran on your processor.

On the other hand, Lua comes with a runtime that will translates strings
of text into code as it comes, every Lua method you're exposing is
needing an extra layer of C code to expose C implementation as Lua
stuff, and you've got a garbage collector that can kick in (almost)

You could make a great MUA in Lua (or in Go, or in Python…), but I doubt
you could achieve the same kind of performance you get with Mutt. And
that does not really matter, Mutt is in C, and the whole point of
Neomutt is to /improve and modernise/ the codebase, not writing an MUA
from scratch!

And definitely, if we were thinking on replacing parts of mutt in Lua,
we'd keep all the low level stuff in C to be exposed as Lua API, and
write stuff like the user interface in Lua (that would work with Python,
or any other high level language). But that's not what we want, current
UI and UX is great ☺

An interesting discussion I'd like to see happen, is what API would be
useful to be exposed as Lua methods so that we can make useful plugin
scripts to extend Mutt and make it better interoperate with other

> And i still think using Rust could be a serious alternative some day.
> I understand it may be less newbie friendly, but i like the stability
> and security warranty a lot.

If we were rebooting mutt from scratch, it'd be both fun and a good
lesson to write it in Rust, as this language aims at being at the same
level as C, but with a lot of neat features to make better more easily
tested code. (That would work with Go, Elixir etc..).

So why stick to C? Because currently there's about 84kloc in C that
offers an efficient way to load mailboxes, and a neat interface to
browse, read, sort and edit mail. C is portable across all Unix
flavours, and most importantly, there's a huge community of C coders.

And finally, you'll understand that Object Oriented programing and
Functional Programing are just ways of coding that will make your code
better, but that can be applied with almost any language. Those are
paradigms you need to apply to your thought process before writing the
lines of code.

I hope you get the point :)



More information about the neomutt-devel mailing list