Feature Request: make void a value type
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Dec 3 09:02:19 PST 2007
"downs" <default_357-line at yahoo.de> wrote in message
news:fj1cc2$13c3$1 at digitalmars.com...
> Proposal: to allow us to treat void as a value type.
> What this would allow:
> * simplifying templates that differ between return type, i.e. static if
> (is(ReturnType!(C)==void)) param(); else return param();
This is already possible. Return statements with expressions in functions
that return void will be evaluated and their results thrown away.
void foo()
{
return writefln("hi!");
}
is the same as:
void foo()
{
{ writefln("hi!"); return; }
}
More information about the Digitalmars-d
mailing list