function is not callable using argument types ()

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 10 00:41:56 PST 2016


import std.stdio;
import std.concurrency;

void main()
{

void sp(int i)
{
	receive((int i)
	{
		writeln("i: ", i);
	});
}

	auto r = new Generator!int(
	{
		foreach(i; 1 .. 10)
			yield(i);
	});

	foreach(e;r)
	{
		sp.send(e); //Error: function app.main.sp (int i) is not 
callable using argument types ()
	}

}


What I am doing wrong? How "receive" can be named? Is it's method 
or what? Why it's without return type?






More information about the Digitalmars-d-learn mailing list