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

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Wed, 17 Sep 2014 17:05:33 +0200

> > If you want to use the type
> > system to ensure the correctness of your code, instead of writing
> > good code then you have an understanding problem about programming.
> That's an odd thing to hear from a professional like you. Making
> mistakes isn't about "writing good code" (what does this even mean per
> se) or not, it's about the fact that humans are not infallible. If

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.

> 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++.

Regards,

-- 
Roberto E. Vargas Caballero
Received on Wed Sep 17 2014 - 17:05:33 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 17 2014 - 17:12:07 CEST