How do you decide this?
In math, one would often have a situation in which an "abstract language concept" - say templates in C++ - would present itself. Now, you see how IF IT REALLY WORKED this would be nice - I've made up an inner-product class and the spaces be damned! - but in the end, I would always opt for specific coding for speed and efficiency and ease of later use. This always works better - meaning - templates are not of any real use for an actual problem, because you have to also maintain the template.