renoX:

one common issue when you optimize code is that the code becomes difficult to read/maintain, but if you're trying to process images there may be hope: Halide is a DSL (currently embedded in C++) which keep the algorithm and the "optimization recipe"(schedule) separated AND the performance can be similar to hand-optimized C++ code.

Maybe some programming language of the future will contain ways to specify code at various levels, like that. I think that's a quite important but unsolved problem of the endavour of designing languages.

Today sometimes you see a complex function (or groups of related functions/methods) that is preceded by a comment that contains the pseudocode version of the algorithm implemented below.

[I suggested the idea of docpicture, to insert small images in doctexts (similar to ddoc comments of D functions), to help explain algorithms implemented inside the following function. Later the idea was implemented by someone else: https://groups.google.com/forum/?hl=en&fromgroups=#!topic/comp.lang.python/ykGwWA0WKfc ]

And one metric of progress in the history of computer language design is more and more content of the comments moved to code that a compiler/interpreter is able to understand (there are practical limits to this, this partially explains why today everybody isn't programming in Idris or ATS that support dependent types: sometimes saying some things to the compiler is not worth the effort).

The idea of writing code in a high level and later specify a second or third layer of optimization on it, keeping the whole thing DRY (don't repeat yourself) seems an important progress for a future language.

Bye,
bearophile

Reply via email to