From 7f71118fa6dd49d1ae33c73b6034c9b9a219c016 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 17 Apr 2022 14:55:23 +0200 Subject: [PATCH] Add to function docs --- docs/Reference/Functions/README.mdr | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/Reference/Functions/README.mdr b/docs/Reference/Functions/README.mdr index 80fb62b9..0c8351e5 100644 --- a/docs/Reference/Functions/README.mdr +++ b/docs/Reference/Functions/README.mdr @@ -16,3 +16,27 @@ fun int test_function(int arg) { #! or use alternate syntax <<< 1 => test_function >>>; ``` + + +## Any Position Method syntax + +Due to the hybrid nature of function call syntax +and the left to right workflow in gwion, +some syntaxic sugar is provided +to call a function with arguments +from both the left and right side + +Arguments coming from the left are referenced as `_` +in the right hand side + +```gwion,editable +fun void myfunc(int i, int j) { + <<< "${i} ${j}" >>>; +} + +#! prints '1 2' +1 => myfunc(_, 2); + +#! prints '1 2' +2 => myfunc(1, _); +``` -- 2.43.0