tech-pkg archive

Rewriting pkglint in a portable language

To : Tech Pkg <tech-pkg%netbsd.org@localhost>

: Subject : Rewriting pkglint in a portable language

: From : Roland Illig <roland.illig%gmx.de@localhost>

: Date: Wed, 23 Mar 2016 21:33:56 +0100

Hi, due to ongoing problems with the portability of the Go programming language, I have considered to rewrite pkglint in another programming language. I estimate that rewriting pkglint, which is currently about 14000 lines of code, will take about half a minute per line, which still amounts to 120 hours. The good point is that this rewrite is not as risky as the last one, since the code is covered by unit tests; at least 80 percent of it. My currently preferred language is Vala/Genie from the GNOME project, which I don't yet speak fluently, but from what I have done in it, it seems to be very easy. * It has garbage collection. * It has memory protection. * It has a built-in string datatype (unlike C). * It has concise syntax. * It compiles to C, using the glib object model, which I guess is portable to all platforms pkgsrc will ever run on. * It compiles to reasonably fast code. * Performance-critical parts could be written directly in C. For benchmarking the speed, I wrote a recursive grep in Go, Vala, Genie and Nim, and compared that to the native grep. I chose this simple task because pkglint heavily depends on IO and parsing text files. The Vala version was about 50 percent slower than the Go version, which in turn had half the speed of the native grep. If someone can convince me that C++ or even C is better suited, please do so. I just fear the undefined behavior too much. Or if you prefer it to be written in a scripting languages like Perl, Python, Ruby, Lua, please provide some hints that it won't execute as slowly as the old Perl version. And, by the way, I like statically typed languages with explicit variable name checking, since they catch many errors at compile time. Are there any other languages out there that I missed? Or tools that could help in the translation? Looking for suggestions, Roland