Mac Apps That Use Garbage Collection Must Move to ARC
via Digitalmars-d
digitalmars-d at puremagic.com
Thu Feb 26 06:21:59 PST 2015
On Thursday, 26 February 2015 at 11:28:16 UTC, ponce wrote:
> That's the problem with future/promises, you spent your time
> explaining who waits for what instead of just writing what
> things do.
There are many ways to do futures, but I don't think it is all
that complicated for the end user in most cases. E.g.
auto a = request_db1_async();
auto b = request_db2_async();
auto c = request_db3_async();
auto d = compute_stuff_async();
r = wait_for_all(a,b,c,d);
if( has_error(r) ) return failure;
> No. If I can't open a file I'd better not create a File object
> in an invalid state. Invalid states defeats RAII.
This is the attitude I don't like, because it means that you have
to use pointers when you could just embed the file-handle. That
leads to more allocations and more cache misses.
> So you can't re-enter that mutex as you asked, so I will grant
> you a scopedLock, but it is in an errored state so you'd better
> check that it is valid!
A file can always enter an errored state. So can OpenGL. That
doesn't mean you have to react immediately in all cases.
When you mmap a file you write to the file indirectly without any
function calls. The disk could die... but how do you detect that?
You wait until you msync() and detect it late. It is more
efficient.
More information about the Digitalmars-d
mailing list