[PC-BSD Dev] PC-BSD scripting langiage... again

Radio młodych bandytów radiomlodychbandytow at o2.pl
Sat Mar 30 01:36:11 PDT 2013

On 29/03/2013 23:01, Torsten Eichstädt wrote:
> PRO: Libraries/Frameworks to write TESTS (!!!) to catch bugs before the
> customer sees them
Same with Python. In the standard library and working well.
Quick search about others lead me to:
Perl and Lua have some frameworks too. So is it really a pro? Lack of 
well working ones might be a cons, but I'm unable to judge others than 
Python here.

> IMHO is Python, but my feeling is that it's too heavy and more
> error-prone than JS.
I work as a Pythonist. I'm coding in it for little over a year, so I 
still remember my newbie mistakes and more, I have 4 newbies in the team 
(though 2 rarely do Python), so I should know some things about what 
bugs happen. Overall, the team has 6 full time and 3 part time pythonists.
You know what? After nearly an hour of thinking about it I remember 4 
cases of language related bugs that reached the repo.
* comparing numbers read from a config as strings. '2' > '10'. Stayed 
undetected for > year.
* bad indentation case 1, happened to a senior programmer who didn't run 
the code even once before checking it in; resulted in an infinite loop, 
so it was detected very easily.
* bad indentation case 2, caused by mixing tabs and spaces. Yeah, this 
should be really prohibited by the language...
* raising NotImplemented instead of NotImpementedError lead to TypeError 
instead of NotImplementedError. Obscure bug in a dead code path. If 
anything relied on NotImplementedError being raised there, it would be 
easily detected, so this was pretty much harmless. Detected when we 
implemented static code analysis.

I can also add a story of a bug that happened to our best Pythonist long 
time before I joined:
* A default function parameter was mutable. It got modified somewhere 
and on the next call the function got a default that was the same 
object, but it differed from what it was initially which confused the 

Almost all bugs that we make are either detected in basic testing 
(usually on the 1st run) or are generic logic mistakes. Some of the 
logic ones could be detected by strengthening the type system. Maybe Lua 
would do better here, but certainly not Perl or JavaScript. Haskell has 
an excellent type system...but so many people fear it...

BTW, I've seen a nice bug in a Perl script recently. This was in SCST ( 
http://scst.sourceforge.net/ ), a pretty major project. The coder was 
checking if strings were empty by converting them to bools which failed 
on "0". It stayed undetected for quite long.

To sum up, I have little experience with JS, but I view Python as pretty 
Heavy? I don't feel this way, but much heavier than Lua or JS for sure.
Twoje radio

More information about the Dev mailing list