Wednesday, September 3, 2008

Language features that I cannot live without

Module/Functor/Template
  • Mesh implementations around for code reuse. Also a detailed specification so the compiler would warn when a particular combination may not produce the desired result (i.e. combining an iterator with O(logn) collection lookup does not result in O(n) algorithm).
Reflection
  • Detailed stack trace when an unhandled exception happens. Requires:

    • Tracing stack frames.
    • Converting code address to symbols.
    • Look-up function type from symbol (so we know how to print the arguments).
    • The facility to convert any run-time value to a string.
  • Unit testing. Also needs to convert any run-time value to a string for printing the test case that fails expectation.
Build system
  • Like ocamlbuild, specify the source code for "main" executable and automatically figures out the dependencies.
  • Should be able to aggregate source files into an artifact (i.e. library) and build around the artifacts.
  • Leverage external Makefile targets when necessary.
Documentation
  • Need a way to automatically generate documentation from source code. The detail would be written as special comments.

Update: (May 29, 2009)

Higher order functions
  • Lexically scoped closures. The closure doesn't have to be heap allocated. I think most closures I use do not escape.
  • Higher-order function inlining. A lot of time I use higher order function to customize an algorithm, like list iterator. In these cases, inlining makes it as efficient as writing the algorithm by hand everytime I use it.

No comments: