www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Bug in Rdmd?

reply Jonathan Marler <johnnymarler gmail.com> writes:
This code doesn't seem to work with rdmd.  Is this a bug?

   import std.stdio : byLine;
   int main(string[] args)
   {
     foreach(line; stdin.byLine) {
     }
     return 0;
   }

Compiler Output:
   Error: module std.stdio import 'byLine' not found
Jun 13 2016
parent reply Jeremy DeHaan <dehaan.jeremiah gmail.com> writes:
On Tuesday, 14 June 2016 at 01:05:46 UTC, Jonathan Marler wrote:
 This code doesn't seem to work with rdmd.  Is this a bug?

   import std.stdio : byLine;
   int main(string[] args)
   {
     foreach(line; stdin.byLine) {
     }
     return 0;
   }

 Compiler Output:
   Error: module std.stdio import 'byLine' not found
Try removing the 'byLine' from the import statement. The error message looks like it can't find the function 'byLine' in the std.stdio module. It isn't a free function, but one of File's methods.
Jun 13 2016
parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Tuesday, 14 June 2016 at 01:35:32 UTC, Jeremy DeHaan wrote:
 On Tuesday, 14 June 2016 at 01:05:46 UTC, Jonathan Marler wrote:
 This code doesn't seem to work with rdmd.  Is this a bug?

   import std.stdio : byLine;
   int main(string[] args)
   {
     foreach(line; stdin.byLine) {
     }
     return 0;
   }

 Compiler Output:
   Error: module std.stdio import 'byLine' not found
Try removing the 'byLine' from the import statement. The error message looks like it can't find the function 'byLine' in the std.stdio module. It isn't a free function, but one of File's methods.
It actually is a free function (not a method on the File object). This works if you compile it with dmd, just not with rdmd.
Jun 13 2016
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 14 June 2016 at 03:15:04 UTC, Jonathan Marler wrote:
 It actually is a free function
no, it isn't, it is on File. Your code doesn't compile on my dmd (and indeed it shouldn't on yours either unless you have a version mismatch. rdmd just calls dmd, it doesn't produce its own errors)
Jun 13 2016
parent Jonathan Marler <johnnymarler gmail.com> writes:
On Tuesday, 14 June 2016 at 03:40:01 UTC, Adam D. Ruppe wrote:
 On Tuesday, 14 June 2016 at 03:15:04 UTC, Jonathan Marler wrote:
 It actually is a free function
no, it isn't, it is on File. Your code doesn't compile on my dmd (and indeed it shouldn't on yours either unless you have a version mismatch. rdmd just calls dmd, it doesn't produce its own errors)
Shoot stupid mistake. You were right Jeremy and Adam. Thanks for replying and showing me my silly error. I could have sworn byLine was a template and calling it with file was just UFCS...and I don't know how I was able to compile that with DMD...must have made a mistake somewhere. Thanks again.
Jun 13 2016