I was thinking how cool it would be to have a Wikipedia but with actual usable algorithms instead of human-oriented text. As I thought about it, it dawned on me that MATLAB's one-function-per-file and 'this'-passed-as-first-param notions (generalized in other languages to full multimethods) are just the kinds of things you'd want in such a system.
Also, the idea of generic mathematical concepts (via interface implementation, duck typing, or static C++ templates) leads to wanting fewer versions of the same function, so namespacing issues might matter a bit less.
Still, I think namespacing matters some. Maybe the ability to apply multiple tags to functions would be nice instead of the draconian namespacing of common programming languages. But could you never have two versions of the same function with the same tag? Maybe just multiple matches based on specified desired tags would result in an error. Hmm.
And I was also thinking about how you could imply templates just by not specifying the types of the parameters (again, the static variation on duck typing).
In the end allow translation to C/C++/Java/C#/whatever based on conventions that work well for that language.
I think the math language itself in the wiki would need to look somewhat like MATLAB (and/or Python). And of course, rendering to nice typeset equations online (image or MathML or LaTeX) would be sweet.
If only I had a ton of additional time on my hands.
No comments:
Post a Comment