Darren Hickling

Testing Interesting Language Features

Published onReading time1 minute

Have you looked at a snippet of code, given it a double-take, then thought "Woah, what is that?" I've found this happens for languages I haven't used at all or often, and those that I am familiar with. Rather than forget those useful or obscure features, I've begun to assemble them in a repository, DidYouKnow. It started with some great examples from Python, like list comprehension, went onto Perl and regular expressions, and naturally, C++, the likely winner of an important code quality measurement.

Rather than hope that these examples actually do what they say, they are implemented as unit tests, and are (hopefully) uncomplicated to run. This proved to be an excellent way of testing and growing my C# knowledge for the interview of my now new employer, too!

This is intended to be a used a reference, hence the documentation comments for each test case. It will also be a constant work in progress, so expect more changes, particularly in structure as the examples grow. I'm intending to add JavaScript next, and would like to try to organise the tests of each language into sections, which would help differentiate the features and quirks of the language itself, and those of the libraries associated with it. As ever, I'd be interested to hear your thoughts, improvements and suggestions, so either let me know, or clone the repository and contribute!