2016-05-30

mindstalk: (Witch)
Writing code in Python is pretty neat. Executable pseudocode! It does match how I think. (Not how everyone thinks: a friend says he's gotten so used to pattern matching a la Haskell/ML now that *that's* part of his pseudocode, and Python is deficient.) Also the interpreter is really nice, and I'm surprised Perl still doesn't have one like it.

Testing code in Python? This seems to suck. Even the most basic lexical analysis isn't done and erroneous variable references don't get caught until the code tries to run.

def dummy():
    rint(stri)

print("hello")


happily prints "hello"; referencing an unassigned variable by calling an undefined function in a function that doesn't run causes no fuss. Naive perl is no better, but strict perl

use strict;

sub dummy() {
    rint $stri;
}

print "hello\n"


generates


Global symbol "$stri" requires explicit package name at test.pl line 4.
Execution of test.pl aborted due to compilation errors.


OTOH, the undefined 'rint' causes no fuss, which surprises me.

I was coding a simple HTTP server in Python, and while it's good to try to exercise all your code paths in testing as it is, I found myself wanting to do so specifically to make sure I didn't have typos in the enumerated constants I was referencing. That should not be an issue in a production language...

Profile

mindstalk: (Default)
mindstalk

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
272829 3031  

Page Summary

Most Popular Tags

Expand Cut Tags

No cut tags

Style Credit

Page generated 2025-08-25 17:23
Powered by Dreamwidth Studios