On Wednesday, 4 February 2015 at 20:15:37 UTC, Andrei Alexandrescu wrote:
On 2/4/15 9:13 AM, Foo wrote:
For what it's worth, today I finished the current work. Now we will start working with it. If someone has critique, improvement suggestions
or want to take some ideas, he is free to do so.
To repeat myself: we rewrote some functionality which already existed in D, but were improvable. For example the existing emplace method is quite long, hard to understand / read and is not marked with @nogc. Since we want to avoid the GC wherever possible we had to rewrite it. I hope it's useful for someone else and that some of you guys take some ideas from it.

https://github.com/Dgame/m3

Opened File.d at random:

@trusted
@nogc
char[] read(const string filename) nothrow {
import std.c.stdio : FILE, SEEK_END, SEEK_SET, fopen, fclose, fseek, ftell, fread;

    FILE* f = fopen(filename.ptr, READ_BINARY);
    scope(exit) fclose(f);

    fseek(f, 0, SEEK_END);
    immutable size_t fsize = ftell(f);
    fseek(f, 0, SEEK_SET);

    char[] str = m3.m3.make!(char[])(fsize);
    fread(str.ptr, fsize, 1, f);

    return str;
}

Then stopped right there. This is nowhere near production quality - there is no error checking whatsoever, does more operations than necessary, won't work on special files etc. etc. etc.

I applaud the intention but there is a lot more work to be done on this before it's in reviewable form.


Andrei

I would be glad if you or Walter could review the other parts as well. I'm very sure that your review will be very helpful and I'm convinced that the modules Array or Smart Pointer could be useful for phobos.

Reply via email to