Compile-time Functions

来源:互联网 发布:it人才缺口 编辑:程序博客网 时间:2024/06/06 11:45

    We programmers are familiar with functions, or runtime functions. They are utilities aiming at encapsulating functionalities.

    In order to do something useful with functions, we need to call a function to execute it. To customize the functionality encapsulated within a function when calling it, we usually need to feed the function with one or more values, which are called arguments at the calling site, or parameters at the called site. After the execution of a function in the runtime,  we usually get back a value in return, which is called the return value of the function. 

    There do exist functions that have no parameters and thus its functionalities cannot be customized. They are often extracted from large functions and used to divide large functionalities into smaller ones. There also exist functions that have no return value, which are called procedures in some programming languages. A function that has no return value will probably do something to the outside world, which is called a side effect. With or without return value, functions can have side effects, but a function that has both a return value and one or more side effects are often considered as a bad design.

    In contrast with runtime functions, we are not so familiar with compile-time functions. There are simply no such terms in most programming languages,

0 0