texmacs-dev
[Top][All Lists]
Advanced

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

[Texmacs-dev] Refcounting, namespaces, const qualification


From: David Allouche
Subject: [Texmacs-dev] Refcounting, namespaces, const qualification
Date: Sun, 13 Oct 2002 20:34:44 +0200
User-agent: Mutt/1.4i

On Fri, Oct 04, 2002 at 03:31:34PM +0200, Joris van der Hoeven wrote:
> 
> > I think that is indeed the best short term solution. Overriding the
> > global allocator seems to me exactly the kind of things that can cause
> > dormant bugs in other packages to show up.
> 
> Absolutely; I will change this as soon as I have time.

Maybe I will give a shot at it sometime soon, too...
 

> > Generally, C++ loves locality: namespaces, member functions, etc...
> > I think that TeXmacs relies too much on the global namespace.
> 
> Right again. During the reorganization, I plan to put virtually all
> global variables into a few dedicated classes.

There is a C++ proverb which says "do not use a class when you need a
namespace". It would be probably easier and cleaner to just put all
those global variables in a 'TeXmacs' namespace, and maybe some nested
namespaces (e.g. edit, typeset, gui).

By the way... enums are namespace savyy, cpp symbols are not.


> > Our point (steph's and I) here is that reference conting must not be
> > abused, and especially that passing by value of counted pointers is
> > horrendous. What is importand is PASSING CONTED POINTERS BY REFERENCE.
> 
> Yes, but putting const's everywhere in the code makes the code less readable.
> I am very much attached to high readability, which does not withstand that
> I understand your technical arguments.

We already had this discussion.

If you think 'const' readuces readability, you may use nested types.
For example 'in' for const reference (input parameter) and 'io' for
reference (inout parameter).


> > Using const-qualification in order to provide more semantically rich
> > source code is another issue. It is much deeper that just passing
> > some parameters as const-references, and may require the use of
> > several new C++ idioms.
> 
> Yes, and I want to delay this.

That is no problem. We all agree there are other priorities, like
reproducing and fixing those 'random segfaults' problems.

-- 
David Allouche         | GNU TeXmacs -- Writing is a pleasure
Free software engineer |    http://www.texmacs.org
   http://ddaa.net     |    http://alqua.com/tmresources
   address@hidden  |    address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.





reply via email to

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