On Tuesday, February 28, 2012 06:56:10 Joshua Niehus wrote: > Hello, > > I dont understand the following snippet's output: > > import std.stdio, std.traits; > void main() { > writeln(isSomeFunction!(writeln)); > writeln(isCallable!(writeln)); > writeln("Yes I am..."); > } > > /* OUTPUT */ > false > false > Yes I am... > > If 'writeln' isn't a method/function and it's not callable, then > what is it?
writeln doesn't even really exist as far as the compiler is concerned until it's been instantiated. So, testing writeln isn't going to work. You need to either test a specific instantiation (e.g. isSomeFunction!(writeln!string))), or you need to just test that particular call works (e.g. is(typeof(writeln(arg)))). The second is probably better, since that's generally what you really care about - is it compilable with the given set of arguments. - Jonathan M Davis