tech-pkg archive

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

Re: Rewriting pkglint in a portable language



Am 24.03.2016 um 09:11 schrieb Patrick Welche:
> On Wed, Mar 23, 2016 at 09:33:56PM +0100, Roland Illig wrote:
>> If someone can convince me that C++ or even C is better suited, please
>> do so. I just fear the undefined behavior too much.
> 
> My impression of vala => the glib object model is that it was developed
> as a way of having objects by defining macros to help order the beginning
> of C structs to effectively have C++ classes in C. C++ compilers have
> come a long way since then, so if you like Vala, why not just use C++?

As I said, C++ has undefined behavior looking around every corner, and I
fear that. Just a single out-of-bounds write can make your program go crazy.

I see this as an unneeded risk when developing applications. If C++ had
proper memory protection and out-of-bounds checks, I would consider it
nice for the task.

What I'm looking for is a language that protects me from most typical
mistakes one can make in programming. C++ provides some kind of
compile-time type checking, but still, there are too many historical
features in the language that make it complicated to understand. Just
today I discovered this pearl of code:

  int x = 3.51 - 0.50;

Both gcc and g++ compile this code happily and without warning, although
it is completely unreasonable. This is one of my reasons for preferring
Go over C and C++, since Go protects me from mistakes like this one. It
also protects me from double-free, invalid pointer accesses, format
string attacks, memory leaks, lossy number conversions and probably some
more. All these are things I don't want to be hidden in my code.

But since Go is currently not portable to as many platforms as necessary
for pkgsrc, it is not the optimal choice, and I looked for alternatives.
Vala is one of them, since it allows programs to be written concise and
be executed fast.

Roland


Home | Main Index | Thread Index | Old Index