Nothing type/value aka Unit
Alex
sascha.orlov at gmail.com
Fri Feb 8 14:26:58 UTC 2019
On Friday, 8 February 2019 at 13:33:23 UTC, Jonathan Levi wrote:
> Here is Sodium's GitHub page:
> https://github.com/SodiumFRP/sodium
So... you want to return something, and void is not possible?
What about something like this:
´´´
import std.experimental.all;
void main() @nogc
{
S!(typeof(null)) s;
auto res1 = s.fun1;
auto res2 = s.fun2;
debug
{
writeln(res1);
writeln(res2);
writeln(unit);
}
}
struct Unit {}
enum Unit unit = Unit.init;
struct S(T)
{
T val;
auto fun1()
{
return val;
}
auto fun2()
{
return tuple();
}
}
´´´
More information about the Digitalmars-d
mailing list