emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs rewrite in a maintainable language


From: Marcus Harnisch
Subject: Re: Emacs rewrite in a maintainable language
Date: Tue, 13 Oct 2015 14:02:21 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b34 (linux)

"Stephen J. Turnbull" <address@hidden> writes:

> Ben Wing did a certain kind of rewriting into C++ with XEmacs (a few
> thousand lines' worth, IIRC), mostly turning typedefs for objects of
> several kinds that resolve to some kind of int-ish into proper classes
> that contained an int-ish member.  This caught a number of bugs via
> syntax errors ("this function takes an unsigned byte by the name of
> Bufbyte and the actual argument is an unsigned byte by the name of
> Ascbyte, so you lose!"), but more readable it isn't.

Just to experiment with templates and partial specialization, I redid
part of his implementation where he used tons of macros and still
ended up with a lot of repetitive code for all sorts of EMACS_INT
derived position types. While the template-code is arguably nicer to
look at, it also helped avoiding a bug in his macro monster where
invoking non-existent macro silently expanded to nothing.

His much appreciated C++-based contribution appears rather
conservative by todays standards, which is understandable considering
the state of C++ compilers at the time of contribution (ca
2002). Given the time it would take any hypothetical C++ rewrite to
mature I wouldn't even bother starting with anything less than
C++2014.

Another potential I would see is the availability of higher-level
(STL) data structures w/o dependencies on external libraries, thus
allowing Emacsen to reduce their number of home-grown data
structures. Seeing comments in ancient code (I think it was related to
memory allocation) that translate to something along the lines of:

  “this magic number used to be value X in an even more ancient
   version, chosen as the result of trial-and-error on a small number
   of architectures at hand at the time of writing, and we have decided
   to increase it for totally non-scientific reasons, purely based on
   application of Moore's Law.”

make me cringe.

Best regards
Marcus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]