From 47988fc638c79fb854a59a86716bf2171616cf90 Mon Sep 17 00:00:00 2001 From: Ben Franksen <benjamin.franksen@helmholtz-berlin.de> Date: Thu, 31 Jul 2014 19:38:48 +0000 Subject: [PATCH] docs: clarified semantics of function definitions --- documentation/Reference.txt | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/documentation/Reference.txt b/documentation/Reference.txt index 8cb4cb4f..ba17d25c 100644 --- a/documentation/Reference.txt +++ b/documentation/Reference.txt @@ -223,15 +223,21 @@ Function Definitions Function definitions are very much like those in C. -The most important difference is that functions declared in SNL get -passed certain implicit parameters. This makes it possible to call -built-in functions as if the code were a normal action block. - -Another difference from C is that SNL functions automatically scope over -the whole program, no matter where they are declared. It is neither -necessary, nor is it allowed, to repeat the function declaration -(without the defining code block, commonly referred to as a "function -prototype") at the top of the program. +The most important difference is that functions declared in SNL get passed +certain implicit parameters. This makes it possible to call built-in +functions as if the code were a normal action block. Note, however, that +there is currently no way to *pass* channel ("assigned") variables to SNL +functions in such a way that you can call built-in functions on them. The +"assigned" status of such a variable is lost and it gets passes to the +function as a normal C value. This means you can call built-in functions +that expect such a variable only if the variable was declared at the +top-level. Lifting this limitation is planned for a future release. + +Another difference from C is that SNL functions automatically scope over the +whole program, no matter where they are defined. It is not necessary (but +allowed) to repeat the function declaration (without the defining code +block, commonly referred to as a "function prototype") at the top of the +program. Type Definitions -- GitLab