News for hackers. Stuff that matters.
Re:My Vision of D’s Future by thiago_fm on Tuesday October 15, 2019 @10:43AM (#21258914)
Can somebody enlighten me, why use D when there is Rust/Go?

I think on almost all cases, and also having a bigger community, it is a win for Rust/Go.

Re:My Vision of D’s Future by jordigh on Tuesday October 15, 2019 @10:49AM (#21259001)
I find D easier to use than Rust or Go because of familiarity. It is very obviously C and C++ inspired but without all the sharp edges.

I also love D's metaprogramming. It feels almost like lisp. Go's lack of generics doesn't allow this and Rust's macros don't feel as comfortable for me.

Yes, D is smaller but it's also big enough for me. I don't feel like I'm missing out on much when I'm using D. If I need a library to do something that isn't already in the fairly generous stdlib, I can find it on DUB.

http://code.dlang.org/

Re:My Vision of D’s Future by snagglegaggle on Tuesday October 15, 2019 @11:05AM (#21259182)
Good post. I haven't used D much, but the only way I really see it as "deficient" is its inability to easily create static binaries, like Go. But in a lot of ways that is never a hard requirement (it is nice, though).
Re:My Vision of D’s Future by BubRoss on Tuesday October 15, 2019 @11:29AM (#21259477)
Why can't D create static binaries? I've never heard that before.
Re:My Vision of D’s Future by arunc on Tuesday October 15, 2019 @01:34PM (#21261227)
I have never heard of that before. I create and link static libraries all the time. My exes are usually a drop in without any dependencies whatsoever.
Re:My Vision of D’s Future by snagglegaggle on Tuesday October 15, 2019 @03:59PM (#21262983)
Sorry -- it can, but in much the same way GCC does. You need to manage all your deps. With go it just happens, a huge time saver.
Re:My Vision of D’s Future by floatboth on Tuesday October 15, 2019 @05:07PM (#21263780)
I'm pretty sure Dub will happily manage your D deps and compile them statically.

But I appreciate how that's not necessary and I can use only system-installed libs with Meson and pkg-config :P

Re:My Vision of D’s Future by pjmlp on Tuesday October 15, 2019 @02:00PM (#21261584)
There is no issue creating static binaries.
Re:My Vision of D’s Future by zombinedev on Thursday October 17, 2019 @04:01AM (#21279870)
You're mistaken. By default D statically links all D dependencies (leaving only libc and possibly OpenSSL (if you need it)) to be dynamically linked (which has it's advantages), but if you want you can statically link all dependencies (including the C ones), just like you can with C or C++. D produces the same format of object files as C/C++ which makes this just as easy.
Re:My Vision of D’s Future by he_the_great on Thursday October 17, 2019 @01:36AM (#21279186)
I think D is still working through lack of support for dynamic libs (lots of headway was made so I may be wrong)

It is funny how Go sold it as a feature, but it was always a deficiency in D (and yes, it just happened out of the box.)

That isn't to say C dynamic libraries didn't work, that is a linker thing, but it would be the same in Go.

Re:My Vision of D’s Future by Neku42 on Tuesday October 15, 2019 @03:44PM (#21262835)
You totally could create static libraries or compile stuff statically inside binaries to create a go style standalone executable but you need to recompile Phobos as a static lib for that
Re:My Vision of D’s Future by mhd on Tuesday October 15, 2019 @12:02PM (#21259946)
Not as exotic as Rust, due to more being in the Algol line of succession than ML's.

But boy, on the Algol-tree, it's about as far away from Go as you can, erm, go. The blog poster's predecessor was about as heavy as you can get into generics without being called Stepanov.

D tends to have quite a lot of features and lets you pick your subset, which brings it closer to languages like C++ or Scala. Go, being basically Oberon filtered through New Jersey, is a lot more minimalistic. Old Java vs. new Java, basically.

Re:My Vision of D’s Future by atilaneves on Wednesday October 16, 2019 @06:20AM (#21268832)
Re:My Vision of D’s Future by mochomocha on Tuesday October 15, 2019 @12:22PM (#21260220)
Compared to Rust: smoother learning curve, and you don't have to fight the compiler so much

Compared to Go: much better designed and richer language.

Obviously in terms of community, it's much smaller. But if you're ready to "build vs buy" more, or if you have some small scope project, I'd encourage you to try it.

Re:My Vision of D’s Future by aldanor on Wednesday October 16, 2019 @07:42AM (#21269288)
"Fighting the compiler" is a common annoying stereotype, quite often quoted by people who don't even know Rust. After a while of using Rust, you no longer fight the compiler, you know how things work, you design and structure your programs with borrowck in mind from the start.
Re:My Vision of D’s Future by zombinedev on Thursday October 17, 2019 @04:12AM (#21279920)
Initially coming from C++ background, e.g. I had good understanding of its ownership model with move vs copy semantics (unique_ptr vs shared_ptr), I read many Rust blogs, watched a couple of tech talks and read several chapters of the book, so everything looked super promising. I even spend reading about linear and affine type theory.

But I can testify that spending my first days with Rust was a struggle the whole way. It's probably because D had spoiled me a lot by the time I got to Rust. After some time I lost interest as Rust didn't offer anything that I was actually missing in D, while D had much to offer in the areas of things I liked.

Re:My Vision of D’s Future by pjmlp on Wednesday October 16, 2019 @07:58AM (#21269413)
Try to write a GUI application in Gtk-rs, or a game engine with the vector clocks array workaround, and you will see that many of us do indeed know Rust when we complain about fighting the compiler.
Re:My Vision of D’s Future by xhgdvjky on Tuesday October 15, 2019 @11:01AM (#21259143)
I work in c++ and D was designed in part to address a lot of c++ complaints. so I find myself with very few issues while writing D. it's just a very enjoyable experience (subjective ik)

the meta programming is very cool also

Re:My Vision of D’s Future by skocznymroczny on Tuesday October 15, 2019 @12:33PM (#21260349)
I am worried the push towards integration with C++ will just turn D into a cheap C++ clone. We already got copy constructors, just to interact with C++ code. More C++ features to come.
Re:My Vision of D’s Future by atilaneves on Tuesday October 15, 2019 @12:41PM (#21260467)
Copy constructors were needed due to type checking const/immutable copying. C++ interop was just icing on the cake.
Re:My Vision of D’s Future by p0nce on Tuesday October 15, 2019 @09:37PM (#21266190)
It's the other way around, C++ is turning into a complicated D clone.
Re:My Vision of D’s Future by floatboth on Tuesday October 15, 2019 @05:21PM (#21263950)
Nothing cheap about being way ahead of C++ in metaprogramming and compile-time programming.
Re:My Vision of D’s Future by ZootAllures91 on Tuesday October 15, 2019 @07:44PM (#21265385)
Well, for example:

  import std.stdio;

  struct Math(string Op) {
    static auto eval(T, U)(T l, U r) {
      static if (Op == "+")
        return l + r;
      else static if (Op == "-")
        return l - r;
      else static if (Op == "*")
        return l * r;
      else static if (Op == "/")
        return l / r;
    }
  }

  static immutable auto result = Math!("+").eval(1, 2) + Math!("*").eval(3.0, 3.0);

  void main() {
    writeln(result);
  }  
  
You'll never be able to do anything like that in Rust until const generics are not only complete on their own, but also fully compatible with "const fn".
Re:My Vision of D’s Future by mhh__ on Tuesday October 15, 2019 @09:21PM (#21266090)
Assuming I formatted it right, I made your example shorter

  import std;

  template Math(char Op) {
     auto eval(T, U)(T l, U r) {
        static foreach(x; "+-*/") {            
         if (Op == x)
          mixin("return l ", x, " r;");        
        }        
    }
  }

  static immutable result = Math!('+').eval(1, 2) + Math!('*').eval(3.0, 3.0);

  void main() {
    writeln(result);
  }
Re:My Vision of D’s Future by ZootAllures91 on Tuesday October 15, 2019 @11:32PM (#21266816)
Yeah, that works too. I was trying not to get too crazy I guess. And also just show all the various levels of "static".
Re:My Vision of D’s Future by petre on Tuesday October 15, 2019 @06:04PM (#21264441)
It's easier and more productive than Rust and has generics, templates, better C interop than Go. Also the GC can be disabled or worked around.
Re:My Vision of D’s Future by 7thaccount on Tuesday October 15, 2019 @08:04PM (#21265532)
Rust is pretty low level. As a Python programmer I can use D a lot easier (with the exception of templates and all the stuff that assumes you know C++ which I don't) than Rust as I don't have to worry about memory.
Re:My Vision of D’s Future by zem on Tuesday October 15, 2019 @05:56PM (#21264357)
D is easier to use than rust and way more capable than go.
Re:My Vision of D’s Future by he_the_great on Thursday October 17, 2019 @01:41AM (#21279214)
While not a targeted answer to why not go/rust, this is my case

https://dev.to/jessekphillips/my-case-for-d-444p

Re:My Vision of D’s Future by pjmlp on Tuesday October 15, 2019 @01:59PM (#21261568)
When you believe in systems programming languages with tracing GC support, powerful metaprogramming and generic code capabilities that compiles as fast as Go.
Re:My Vision of D’s Future by ttkciar on Tuesday October 15, 2019 @03:57PM (#21262966)
.. and with much better run-time performance than Go.