Announcement

Collapse
No announcement yet.

D Language Front-End Proposed For GCC 8, 800k Lines of Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by microcode View Post

    D has a couple of things which some people like. It is like C++ (but with none of the bizarre intermediate legacy features which sane people avoid like the plague), except that it uses a garbage collector by default, instead of RAII. It also has compile-time execution, so it can execute any valid D expression at compile time instead of executing it every time the program runs; a similar feature exists in other languages like Elixir. This can be very useful for compiling configurations or other human-readable text into dense datastructures cleanly and without any special build system support.

    Rust is safer. D is probably less anal, shooting for some medium where it's hard to introduce allocation bugs, but slower to allocate and free because of GC; you will probably spend less time refining the behaviour of your program in D, but you will pay a performance (and correctness) penalty compared to Rust.
    Just to clarify, RAII as an idiom doesn't contradict something that's garbage collected. D can use RAII extensively while still being garbage collected.
    The language used to not be garbage collector oriented but various functionalities require a garbage collector currently such as string splitting. Yeah, it's fast to allocate but collection is actually pretty slow still (unless they've changed it in the past few years). If it's a real-time application, it's extremely important to remember it's garbage collected since you will fight the GC any time it's collecting unfortunately. If you wish to avoid the GC, there are various rules in which you have to follow and nothing within the compiler or current standard library (phobos still?) to enforce it.

    Rust is safer than D in my opinion since it uses language rules to guide the user to correct usages of the allocator rather than doing it pragmatically at runtime (which will still have a chance of memory leakage on abuse anyways). I'm not particularly fond of the Rust syntax honestly but it's currently what I would call the most probable"Next" language because of its approach. I can build a real-time application in Rust without having a few hundred lines of complicated code (possibly more) fighting the GC anytime it collects while I gain semantics that help me from fucking up memory management.

    Comment


    • #12
      Is it me or has D's opportunity for success passed slready? Serious question here as C++ has been vastly improved for the old guard and the newer generation of developers has better languages to choose from. A GC just seems to be D's biggest downfall for the areas it seems to be targetted at.

      Comment


      • #13
        Originally posted by Jumbotron View Post
        Just curious. What is the D language good for other than someone who hates C or C++ syntax ? And as far as safety is concerned how does D compare to Rust ?
        IMO: Rust is an alternative to C, not C++. Rust lacks real metaprogramming(the macros aren't enough) whereas D heavily iterates and improves upon C++'s metaprogramming to actually make it usable instead of an accidental afterthought.
        Which is expected considering Alexander Andrescu is one of the creators of D(since version 2).

        Personally, I found D to offer productivity levels of Python. No other natively compiled language compares in my experience. Rust felt like I was constantly working against the language and the language was designed for computers instead of humans(and it was). As an aside, D compiles way faster than both despite heavy abuses of template-based metaprogramming because the language was designed from the ground up to be fast to compile. It rivals Go in compile speed in my experience.
        I'm not fanboying, I haven't touched the language for probably ~2 years now. I use C++ at my work.

        Also, UFCS is one of the best things ever.
        Last edited by peppercats; 28 May 2017, 04:21 PM.

        Comment


        • #14
          Originally posted by wizard69 View Post
          Is it me or has D's opportunity for success passed slready? Serious question here as C++ has been vastly improved for the old guard and the newer generation of developers has better languages to choose from. A GC just seems to be D's biggest downfall for the areas it seems to be targetted at.
          No. C++ is still an incredibly verbose, ugly three hundred headed hydra with a text-based preprocessor that's incredibly difficult to parse and slow to compile. New features are just makeup on a pig.

          Comment


          • #15
            Originally posted by peppercats View Post
            Rust felt like I was constantly working against the language and the language was designed for computers instead of humans(and it was).
            This only happens during the first week or two of learning Rust. After that period, it's a major advantage.

            Comment


            • #16
              Originally posted by Jumbotron View Post
              Just curious. What is the D language good for other than someone who hates C or C++ syntax ? And as far as safety is concerned how does D compare to Rust ?
              Actually D is for those who DO like the C++ syntax and wish that C++ didn't suck. Rust is an entirely different language, generally lower level than D but with a very powerful type system and heavily influenced by functional languages. Generally speaking D is much more familiar to people used to C/C++. Rust is safer (incl. than D's safe subset) and usually achieves better runtime performance at the cost of a much steeper learning curve.

              Comment


              • #17
                Originally posted by jacob View Post

                Rust is safer (incl. than D's safe subset) and usually achieves better runtime performance at the cost of a much steeper learning curve.
                Why is it safer than @safe D? Also, D seems to win in the benchmarks I found in term of runtime performance.

                Comment


                • #18
                  Originally posted by peppercats View Post
                  No. C++ is still an incredibly verbose, ugly three hundred headed hydra with a text-based preprocessor that's incredibly difficult to parse and slow to compile
                  this bullshit can be said only by someone who never compiled with optimizations
                  Originally posted by peppercats View Post
                  New features are just makeup on a pig
                  and never used new features

                  Comment


                  • #19
                    Originally posted by pal666 View Post
                    this bullshit can be said only by someone who never compiled with optimizations
                    ....have nothing to do with being slow to compile?

                    Comment


                    • #20
                      Originally posted by pal666 View Post
                      this bullshit can be said only by someone who never compiled with optimizations
                      English not your first language?

                      and never used new features
                      That are incredibly verbose and ugly just like the rest of the language. e.g, look at the lambda syntax

                      Simple lambda that takes two arguments, adds them, and returns the value:
                      C++:
                      Code:
                      [](auto a, auto b) { return a + b; }
                      Rust:
                      Code:
                      |a, b| a + b
                      D:
                      Code:
                      (a,b) => a + b

                      Comment

                      Working...
                      X