Am 26.04.2012 23:59, schrieb bearophile:
Sönke Ludwig:
See http://vibed.org/ for more information and some example
I see the code:
import vibe.d;
...
static this()
{
listenTcp(7, (conn){ conn.write(conn) });
}
Isn't it better to use this?
import vibe.all;
And in the last line is a semicolon missing?
listenTcp(7, (conn){ conn.write(conn); });
Bye,
bearophile
Ah yes, the semicolon got lost while transforming "conn =>
conn.write(conn)" to "(conn){ conn.write(conn); }" because the lamdba
syntax was a bit surprising there.
The "import vibe.d;" is actually just a play on the frameworks name and
just should be easy to remember. In addition to importing all modules,
it also imports a module containing the main function, so this is a
special beast. But there is actually a "import vibe.vibe;" which is the
equivalent to the "vibe.all".
Sönke