Why is this code returning the wrong type?

2013-05-23 Thread Gary Willoughby
Why won't the following code compile? Here's the error: filewatcher.d(21): Error: cannot implicitly convert expression (new File(file, r)) of type File* to shared(_iobuf)* /** * Imports. */ import std.stdio; /** * A class to watch for changes in a file. */ class Example { /**

Re: Why is this code returning the wrong type?

2013-05-23 Thread David
Am 23.05.2013 18:27, schrieb Gary Willoughby: Why won't the following code compile? Here's the error: filewatcher.d(21): Error: cannot implicitly convert expression (new File(file, r)) of type File* to shared(_iobuf)* /** * Imports. */ import std.stdio; /** * A class to watch for

Re: Why is this code returning the wrong type?

2013-05-23 Thread John Colvin
On Thursday, 23 May 2013 at 16:27:19 UTC, Gary Willoughby wrote: Why won't the following code compile? Here's the error: filewatcher.d(21): Error: cannot implicitly convert expression (new File(file, r)) of type File* to shared(_iobuf)* /** * Imports. */ import std.stdio; /** * A class

Re: Why is this code returning the wrong type?

2013-05-23 Thread Gary Willoughby
File is a wrapper around a FILE*, it's not the same as a FILE* No need for new, File is a struct, new is (normally) for classes. No need for this., although there's no harm in it. Ah yes, thanks.

Re: Why is this code returning the wrong type?

2013-05-23 Thread Gary Willoughby
Hmmm... Following your example i'm still having problems compiling this simple snippet: import std.stdio; class Example { private FILE _file; public this(string file) { this._file = File(file, r); } } Error: test.d(9): Error: cannot implicitly

Re: Why is this code returning the wrong type?

2013-05-23 Thread dennis luehring
Am 23.05.2013 21:45, schrieb Gary Willoughby: Hmmm... Following your example i'm still having problems compiling this simple snippet: import std.stdio; class Example { private FILE _file; public this(string file) { this._file = File(file, r); }

Re: Why is this code returning the wrong type?

2013-05-23 Thread Gary Willoughby
you former private FILE* _file wasn't an File and your current private FILE _file is still not File because FILE and File is something differnt (case sensitive) why not write private File _file Gah! of course. Thanks. I think i better get some sleep...