It works easily when i use classes (just as a workaround): interface ParseFn { ParseFn opCall(char[]); } class Example : ParseFn { ParseFn opCall(char[] s) { if (s == "") return null; else return this; } } int main(char[][] args) { ParseFn parser = new Example(); while (parser !is null) { char[] s; s = din.readLine(); parser = parser(s); } return 0; }