I’m writing the game Snake in lots of programming languages, for fun, and to try out new languages.
Slides: Snake in Ruby
If you want to, you can Support me on Patreon.
C++ template meta-programming sounds harder than it is.
So long as you can fight through some horrific syntax and understand recursive functions, you can write any algorithm you like and have it run at compile time in your C++ programs.
Slides: Simple Template Programming
Andrei Alexandrescu’s amazing book on using template meta-programming for really useful, cool stuff is: Modern C++ Design.
A quine is a program that prints out its own source code. I will describe five examples:
Slides: Five Quines
Arguably the greatest program ever written:
More info on quines:
I’m going to use a word here – don’t stop reading: Metaprogramming. Does the language provide what you need to avoid repeating yourself?
Repeating boilerplate code, algorithms and most importantly ideas, slows you down, makes maintenance difficult, and allows all kinds of mistakes to creep in. If a language provides the ability to abstract, name and re-use all the different types of structure it contains, you can avoid harmful repetition.
Here are some things I like:
Until you’ve experienced the freedom of totally generic code in a language like Scheme it’s hard to explain why the “Generics” features of some languages are so lacking. Of course, static typed languages work under different constraints. Would it be possible to write a language with very strong generic programming features, but which still allows static typing and compiling to native, non-generic code? I think so.