I have too many TODOs in my sources. I use them all the times! I even use them as identifiers when I am unsure about what to name my precious new functions and types!

Everything that requires a name and I can’t think of one right now? TODO will do.

But it’s very hard to come up with the same approach for actual programs. I cannot use TODO as the body of a function or the right hand side of a definition, declaration or assignment. It seems like there is no sure way, that you can always use, to delay the definition of a part of your program.

Except that sometimes it is easy. Some environments make it easy to leave holes in your programs for your future self to fill.

In dynamicly typed languages you can refer to unbound identifiers. Give the hole a name and then refer to it somewhere where you want the hole to be.

Your program may crash when it references such identifier or it may ask you to define them. The user experience of holes differs between programming languages but a program with a hole is definitely something that can be done in a dynamic language.

In statically typed languages instead it’s quite hard to leave a hole and still get a program. There is previous work addressing that but it’s not a widespread feature of languages. As with many other crazy ideas Haskell provides an undefined constant that you can use for this very purpose.

You can put it anywhere and it will compile. When evaluated, it throws an exception “undefined”. But thanks to laziness you can put it anywhere you’ve not written yet.

The user experience of using undefined is wonderful.

My buffer is not showing a parse error anymore, there are no type errors and most importantly I can use any term containing undefined just fine.

Another important mention is Isabelle/HOL. They also provide a undefined constant that you can use to leave holes to be filled later. Obviously this approach is not enough when we get to actually proving properties of the holes but it’s very refreshing to work in a strictly typed language with holes.