[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] function body doesn't return a value
From: |
Jose E. Marchesi |
Subject: |
Re: [BUG] function body doesn't return a value |
Date: |
Sun, 10 Apr 2022 12:56:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> fun body1 = void: {};
> var body2 = lambda void: {};
>
> typeof(body1);
> typeof(body2);
>
> both give me an error:
> <stdin>:1:8: error: function doesn't return a value
>
> is this a bug?
Nope, not a bug.
In Poke when you refer to a function that does not get arguments, it is
invoked, i.e. given
fun foo = int: { return 10; }
this
var v = foo ();
can also be written as simply:
var v = foo;
You can refer to the function value (without evaluating) regardless of
the number of arguments it takes by putting it within parenthesis:
(foo)