19 karma · joined Mar 17, 2011 (15y ago) · 11 submissions
comment 6y ago · link · parent
comment 6y ago · link · parent
struct FlagImpl(string name) { bool value; alias value this; }
struct Flag { alias opDispatch(string name) = FlagImpl!name; }
struct Yes { static auto opDispatch(string name)() { return FlagImpl!name(true); } }
struct No { static auto opDispatch(string name)() { return FlagImpl!name(false); } }
void fun(Flag.foo a) {} // Look ma, no quotes!
unittest { fun(Yes.foo); fun(Flag.foo(true)); }
comment 9y ago · link · parent
Programming started out with one very limited language (machine code), the spread out to cover the world, and new languages flourished. As technology progresses and the world becomes smaller, having fewer languages (or at least, a few common languages) will make more sense. With the advent of the singularity, the world will have become so small a single language might be the best option.=
comment 9y ago · link · parent
You will need to recreate the C++ function definitions in D and mark them extern(C++), but that's about it.
comment 9y ago · link · parent
https://dlang.org/spec/garbage.html#obj_pinning_and_gc
There's also been some work on a precise GC for D:
https://forum.dlang.org/post/hdwwkzqswwtffjehenjt@forum.dlan...
comment 12y ago · link · parent
http://dlang.org/phobos/std_traits#hasElaborateDestructor
I believe this is what you're looking for. Mayhap you need to combine it with hasElaborateCopyConstructor and/or other functions in std.traits.
comment 14y ago · link · parent
While this may be true for many people, there are plenty of parents out there who would do a much worse job than school would in teaching their children.
Sure, there are parents who are great at homeschooling, and who might even have time to do it (some of them have jobs, I hear), but this is not true for the vast majority.
Schools, in addition to providing some modicum of education, offer children a place to be while their parents are at work, and one where they can interact with others of their age in a controlled environment.