On Tue, Feb 17, 2009 at 10:02 AM, grauzone <n...@example.net> wrote: > > But many people would like to use import() to read binary data.
Oh, I'm not saying import() is in the wrong here :) just that that's where his mixed line endings are coming from. > I guess one could extend the language specification to solve this: > > //load, convert line endings, check for valid UTF-8 > char[] import_text(char[] filename); > > //return unchanged file contents as byte array > ubyte[] import_binary(char[] filename); > > On the other hand, both could be implemented as compile-time functions using > the current import(). I suppose, as long as CTFE were made a bit more efficient. Can you imagine doing line-end conversions on a 20k line text file at compile time? The compiler would probably explode.