Your question is too general, it is very difficult to figure out exactly what you are looking for or what could be used to solve your issue. It may be that you need simple modules, or possibly callbacks as suggested earlier by
atcroft, or possibly dispatch tables, or function factories, closures, objects, etc. Maybe you should give a limited example of something you are trying to do and feel it could possibly be done in a more optimal way (e.g. with less code duplication, with better performances, whatever exactly you are after).