Re: [dev] [RFC] Design of a vim like text editor

From: Maxime Coste <>
Date: Wed, 17 Sep 2014 19:15:51 +0100

On Wed, Sep 17, 2014 at 05:05:33PM +0200, Roberto E. Vargas Caballero wrote:
> Yes, but I don't agree the type system must be used for this kind of
> errors. What happens if you mix variables about count of lines of
> different buffers? The type system will not detect anything, and
> if you go ahead and declare a type for the line count of every
> buffer then the code will be horrible.
> If you want detect this kind of errors you can apply another techniques,
> but not the type system. If you have a variable that is a integer count,
> then the correct type is an integer.

Are you saying we should not use a tool to help with a problem if it
is not able to help with every similar problems ?

I can eliminate a good bunch of hard to catch bugs, think about how
easier working with utf8 (where confusing byte counts and char counts
happens easily) when your compiler tells you 'nope, that cannot possibly
be right'. I have access to a tool, its not perfect, I'd rather use
a strong typedef or somothing, but I wont reject it for that.

> > someone knows their own mistakes and wants to use the benefits of
> > proper type system (which C unfortunately lacks altogether and C++
> > attempts to fix the C mess are, while valiant, broken as well), you
> > cannot possibly condemn him for that.
> Yes, and this is the reason why you cannot pass a char * to a
> function that expects a const char *, where a function that doesn't
> modify the content of the buffer should accept a non constant array.
> The solution in c++, a cast, hides another errors, like for example
> you pass a pointer to int. Usually when you have a cast is because
> you are doing something wrong (at least with pointers), and you
> have to use a lot of them in c++. I think the mess is the type
> system of c++.
Oh boy, you don't know much about C++ do you, of course a char* is
implicitely convertible to const char*. On pointer semantics, the
only difference between C and C++ is that void* is not implicitely
convertible to other pointer types (from is ok).


Maxime Coste.
Received on Wed Sep 17 2014 - 20:15:51 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 17 2014 - 20:24:08 CEST