My understanding is that RC is relatively expensive in time (especially for atomic RC) but uses a lot less memory than state of the art fast GC. And RC doesn't handle cycles.
D doesn't store capacity in each slice. This allows a slice to fit in registers more often. Instead for GC allocated slices, the GC will store metadata before the first element of the allocation. That does make it…
Because Go designers don't like OOP and didn't want low-level system programming as core features. They also were not keen on generic programming. Basically they wanted a simpler language. (Then they realized generics…
This compiles: ref ubyte[n*2] requires_ptr_twice_as_large_as_input(uint n) ( const ref ubyte[n] input, ref ubyte[n*2] output, ) { output[0..n] = input[0..n]; output[n..2*n] = input[0..n]; return output; } void main() {…
Why is your proposal better than this: import std.sumtype; void main(){ struct A { int a; } struct B { string b; } struct C { bool c; } alias TaggedUnion = SumType!(A, B, C); auto tgu = TaggedUnion(B("hi")); int i =…
Class instances can go on the stack too using `scope`: scope obj = new Object; ... // destroyed at end of scope
Arrays and slices really have nothing to do with generic programming. Java has poor generic support (type erasure) and C++ has poor syntax and a bad design for iterators. Languages with decent generics support have none…
C's preprocessor means C code can often do interesting tricks, such as the X macro: http://www.drdobbs.com/the-new-c-x-macros/184401387 There are tons of other interesting uses for macros. Obviously I'd rather a…
None of those things cause as much greenhouse gas emissions as a high meat diet. The level of meat consumption in rich countries is unjustifiable.
> C++ has the best (imperative) language support for templates D's template support is far superior: static if, constraints, compile-time function execution, string mixins, opDispatch. These features make templates…
Actually it is simple: eat less meat. Meat production is vastly more wasteful than vegetable production calorie-for-calorie.
The problem is it's no better than C - the correct way is to return sum types, either values or errors. A good language would statically check that any returned values are only used when there are no errors, preventing…
> D's garbage collection is global, and either off or on That makes it sound like you can't use GC and manual memory management together; you can - std.container uses manual memory management internally for max…
> things that were mutable are still mutable `string` is immutable. You can use immutable everywhere if you like. C++ doesn't even have transitive const. > templates are still templates With constraints, unlike…
My understanding is that RC is relatively expensive in time (especially for atomic RC) but uses a lot less memory than state of the art fast GC. And RC doesn't handle cycles.
D doesn't store capacity in each slice. This allows a slice to fit in registers more often. Instead for GC allocated slices, the GC will store metadata before the first element of the allocation. That does make it…
Because Go designers don't like OOP and didn't want low-level system programming as core features. They also were not keen on generic programming. Basically they wanted a simpler language. (Then they realized generics…
This compiles: ref ubyte[n*2] requires_ptr_twice_as_large_as_input(uint n) ( const ref ubyte[n] input, ref ubyte[n*2] output, ) { output[0..n] = input[0..n]; output[n..2*n] = input[0..n]; return output; } void main() {…
Why is your proposal better than this: import std.sumtype; void main(){ struct A { int a; } struct B { string b; } struct C { bool c; } alias TaggedUnion = SumType!(A, B, C); auto tgu = TaggedUnion(B("hi")); int i =…
Class instances can go on the stack too using `scope`: scope obj = new Object; ... // destroyed at end of scope
Arrays and slices really have nothing to do with generic programming. Java has poor generic support (type erasure) and C++ has poor syntax and a bad design for iterators. Languages with decent generics support have none…
C's preprocessor means C code can often do interesting tricks, such as the X macro: http://www.drdobbs.com/the-new-c-x-macros/184401387 There are tons of other interesting uses for macros. Obviously I'd rather a…
None of those things cause as much greenhouse gas emissions as a high meat diet. The level of meat consumption in rich countries is unjustifiable.
> C++ has the best (imperative) language support for templates D's template support is far superior: static if, constraints, compile-time function execution, string mixins, opDispatch. These features make templates…
Actually it is simple: eat less meat. Meat production is vastly more wasteful than vegetable production calorie-for-calorie.
The problem is it's no better than C - the correct way is to return sum types, either values or errors. A good language would statically check that any returned values are only used when there are no errors, preventing…
> D's garbage collection is global, and either off or on That makes it sound like you can't use GC and manual memory management together; you can - std.container uses manual memory management internally for max…
> things that were mutable are still mutable `string` is immutable. You can use immutable everywhere if you like. C++ doesn't even have transitive const. > templates are still templates With constraints, unlike…