Call a function: Difference between revisions
Content added Content deleted
Line 1,743: | Line 1,743: | ||
<lang Dyalect>//Built-in functions are regular functions from an implicitly imported "lang" module |
<lang Dyalect>//Built-in functions are regular functions from an implicitly imported "lang" module |
||
//There is no actual difference between these functions and user-defined functions |
//There is no actual difference between these functions and user-defined functions |
||
//You can however right a function that would check if a given function is declared in "lang" module: |
|||
func isBuiltin(fn) => |
|||
fn.Name is not nil && fn.Name in lang && lang[fn.Name] == fn |
|||
func foo() { } //A user-defined function |
|||
print(isBuiltin(foo)) //Prints: false |
|||
print(isBuiltin(assert)) //Prints: true</lang> |
|||
Distinguishing subroutines and functions: |
Distinguishing subroutines and functions: |