_______               __                   _______
       |   |   |.---.-..----.|  |--..-----..----. |    |  |.-----..--.--.--..-----.
       |       ||  _  ||  __||    < |  -__||   _| |       ||  -__||  |  |  ||__ --|
       |___|___||___._||____||__|__||_____||__|   |__|____||_____||________||_____|
                                                             on Gopher (inofficial)
   URI Visit Hacker News on the Web
       
       
       COMMENT PAGE FOR:
   URI   Programming in D: Tutorial and Reference
       
       
        pmags wrote 1 day ago:
        It's been about 10 years since I last dipped my toes in the D waters.
        
        At the time (v 2.067) I stumbled across some surprisingly bad warts  in
        the standard library that prevented me from using it for my intended
        purposes which writing software tools for bioinformatics.
        
        As other posters have noted, language elegance is secondary to the
        ecosystem when you want to get things done.
        
        For anyone who has been using D for an extended period, has the D
        ecosystem improved / expanded considerably in the last 5-10 years?
       
          Alifatisk wrote 12 hours 22 min ago:
          The Youtube channel Tsoding did a great overview of the D language,
          overall, he liked it!
       
        Defletter wrote 1 day ago:
        Really wanted to like Dlang but I just did not have a good time with
        it.
        
        One of my projects has a really simple server written in nodejs that's
        basically (in terms of complexity) just an auth'd chatroom, and I
        wanted to switch it from using raw tcp sockets to websockets. And since
        the server is so simple, why not refactor it to another language and
        see if there's no some performance gains from that? I ended up doing
        something pretty similar to that "Comparing 10 programming languages. I
        built the same app in all of them." video from Tom Delalande ( [1] ). I
        had several working versions of the server in:
        
        - Bun, using Bun APIs ( [2] )
        
        - Dart, using Dart APIs ( [3] )
        
        - Java, using Java-WebSocket ( [4] )
        
        - Kotlin, using Ktor ( [5] )
        
        - Rust, using tokio-tungstenite ( [6] )
        
        - Zig, using websocket.zig ( [7] )
        
        - D, using serverino ( [8] )
        
        And Dlang was, by far, the worst experience out of the lot. Firstly is
        the lack of adequate, comprehensive, and centralised tooling. I almost
        gave up when dmd could not even compile a freshly init'd project. The
        impression I got is that you're not really meant to use dmd directly,
        you're meant to use dub, like how you compile Java projects with
        Maven/Gradle, not javac. Except that there's also apparently three
        competing compilers ( [9] )? And good luck remembering the names of the
        tooling because they're all some random three-letter combination.
        
        Serverino makes heavy use of mixins and attributes (think Java
        annotations), which is not ideal. But what really killed the deal was
        (despite using the recommended intellij plugin ( [10] ) with the
        recommended tools installed and setup) not being able to inspect[1]
        serverino's mixin or its attributes. So I look at serverino's source
        code, except its source also has mixins... which I can't inspect. I'm
        not going to use something when I cannot easily ascertain its control
        flow. And while, yes, I probably should have gone with vibe-d ( [11] )
        in the first place, mixins and attributes are nonetheless part of the
        language and the tooling should be able to tell me about them.
        
        - [1] When I say "inspect" I mean requesting the IDE to show me the
        source/definition so I can see what it is, what it does, and where it's
        known to be used.
        
   URI  [1]: https://www.youtube.com/watch?v=-MbTj8DGOP0
   URI  [2]: https://bun.sh/docs/api/websockets
   URI  [3]: https://api.dart.dev/stable/latest/dart-io/WebSocket-class.htm...
   URI  [4]: https://github.com/TooTallNate/Java-WebSocket
   URI  [5]: https://start.ktor.io/p/ktor-websockets
   URI  [6]: https://docs.rs/tokio-tungstenite/latest/tokio_tungstenite/ind...
   URI  [7]: https://zigistry.dev/packages/karlseguin/websocket.zig/
   URI  [8]: https://code.dlang.org/packages/serverino
   URI  [9]: https://wiki.dlang.org/Compilers
   URI  [10]: https://wiki.dlang.org/IDEs
   URI  [11]: https://code.dlang.org/packages/vibe-d%3Ahttp
       
          trikko wrote 1 day ago:
          Hi there. I'm the serverino's author.
          
          Could you please explain better what's wrong with it?
          
          It could be useful to improve newcomers experience.
          
          How did you choose serverino over other frameworks?
       
            Defletter wrote 17 hours 12 min ago:
            Oh the issue isn't with serverino itself but with the lack of
            tooling-support for the language features that serverino makes
            heavy use of. And while serverino is open source, so one can
            ultimately view its source code, not having access to modern IDE
            type inspection adds a lot of unnecessary friction.
       
              trikko wrote 14 hours 39 min ago:
              Still curious: How did you choose Serverino among the many
              servers?
       
                Defletter wrote 11 hours 49 min ago:
                Might seem silly, but the choice just came from looking at (
                [1] ) and seeing that serverino is the only one maintained.
                vibe-d isn't listed there, I only learned about that later.
                Basically, serverino has good SEO.
                
   URI          [1]: https://code.dlang.org/search?q=websockets
       
                  trikko wrote 9 hours 42 min ago:
                  Thanks, good to know. Also the fact that you searched
                  directly on the site is a clue for me :)
       
                    Defletter wrote 9 hours 22 min ago:
                    How so, if I may ask?
       
                      trikko wrote 2 hours 27 min ago:
                      Well, you might have searched for GitHub or got there
                      from some page where serverino was mentioned (forum, ...)
                      or maybe someone suggested it to you in the community.
                      Once a program of mine was mentioned in a telegram
                      channel and I started seeing a lot of stars on github and
                      I didn't understand why.
       
          GoblinSlayer wrote 1 day ago:
          How did you build the rust project? The docs say:
          
          > Most Rust programmers don't invoke rustc directly, but instead do
          it through Cargo. It's all in service of rustc though! If you want to
          see how Cargo calls rustc, you can
          
          $ cargo build --verbose
       
            Defletter wrote 1 day ago:
            Sure, but everything seems to point users towards using the
            compiler, not the package manager. For example:
            
            - The tour guide first recommends dmd ( [1] ), though it does
            mention dub at the bottom
            
            - Clicking "Documentation -> Command-line Reference" takes you to
            dmd, with only the barest mention of dub
            
            - Even this post, the "Programming in D" book, tells you to use dmd
            and doesn't mention dub at all.
            
   URI      [1]: https://tour.dlang.org/tour/en/welcome/run-d-program-local...
       
          LugosFergus wrote 1 day ago:
          I found the lack of mature tooling to be hugely problematic. The
          Visual D extension always felt flimsy and unreliable when debugging
          D.
          
          DUB also exhibits weird behavior. For example, I wanted it to produce
          separate debug and release binaries, which it won't do out of the
          box. Instead, it'll create the same binary for both configurations.
          Changing that behavior was more difficult than it needed to be. Maybe
          it's changed since then, but I didn't have a pleasurable experience.
       
          throwawee wrote 1 day ago:
          Tangential, but which of the 7 ended up being the best experience?
       
            Defletter wrote 1 day ago:
            It's a tossup between Dart and Bun: Dart has better language
            features but Bun has better APIs. Since Bun is first and foremost a
            Javascript runtime, it inherits its annoyances and issues, like the
            complete lack of pattern matching, or switch expressions at all, or
            decent enums, etc. That said, Bun includes SQLite support and
            encryption out of the box, whereas Dart is heavily
            compartmentalised ( [1] ). Imagine if, in Bun, importing
            "node:crypto" meant needing a "node:crypto" npm dependency. Dart
            ekes out the win though, I think.
            
   URI      [1]: https://pub.dev/publishers/dart.dev/packages
       
          dimgl wrote 1 day ago:
          > And Dlang was, by far, the worst experience out of the lot. Firstly
          is the lack of adequate, comprehensive, and centralised tooling. I
          almost gave up when dmd could not even compile a freshly init'd
          project.
          
          Yep this also happened to me when I tried D. I love the idea of the
          language and the syntax is great, but I really don't want to fight my
          tools when I'm working on a project.
       
        usrbinenv wrote 1 day ago:
        I constantly feel like inferior languages are picked up, while superior
        languages are discarded. It's almost as if the universe had a law:
        "inferior technology is always preferred no matter how hard you
        seethe".
        
        Examples:
        
          * Python preferred over Ruby
          * TypeScript preferred over Dart or even JavaScript (which is fine
        and, as a bonus, doesn't require compilation step like TS)
          * Go is preferred over Crystal and D.
        
        While Python, TypeScript and Go are quite alright, there is no doubt in
        my mind that their alternatives are absolutely superior as languages.
        Yes, in case of Dart, Crystal and D the ecosystem doesn't have the
        abundance of well-tested libraries, but as languages they are simply
        better. The Go argument that it's popular because it's simpler is
        absurd in the sense that no one really forces you to write complex code
        and use classes or other advanced OOP features in D.
       
          chenzhekl wrote 13 hours 47 min ago:
          The superior languages on your list just reflect your personal
          preferences. There are not perfect languages, just appropriate
          languages for given application.
       
          Shorel wrote 14 hours 31 min ago:
          > The Go argument that it's popular because it's simpler is absurd in
          the sense that no one really forces you to write complex code and use
          classes or other advanced OOP features in D.
          
          The same argument applies to C++. No one is forcing you to create
          complex nested templates or other difficult features.
          
          Yet many criticisms to the language are in the form:  "But it is
          possible to write very complex code that no one understands!"
          
          It is absurd.
       
          nilslindemann wrote 14 hours 35 min ago:
          > Python preferred over Ruby
          
          Python's syntax is closer to written human language, and it uses more
          obvious words.
          
          > TypeScript preferred over Dart or even JavaScript
          
          Typescript is a strict superset of JavaScript.
          
          > Go is preferred over Crystal and D
          
          Go is backed by a big Corp
       
          byteknight wrote 23 hours 59 min ago:
          On what planet is JS better than TS. You ever work with JS?
       
          bnolsen wrote 1 day ago:
          Having coffee almost 30 years in c++ I really good tired of the
          complexity of it. Some of the newer complexity being workarounds for
          (in retrospect) poor decisions made decades ago. Build system
          situation never helped, and I still despise cmake.  When D came out I
          was interested but garbage collection immediately turned me off, in
          my opinion the boost shared pointers (later adopted into the
          standard) solved and shut the door on memory leaks as a serious
          issue.
          
          And then the d2 fiasco sort of blew it all up. Doesn't help that the
          language always felt very heavy to me.    Likewise Rust feels heavy and
          cumbersome itself.
          
          So it ends up that I'm another one of those who feels the itch
          getting scratched by zig.
       
            WalterBright wrote 1 day ago:
            > When D came out I was interested but garbage collection
            immediately turned me off,
            
            Only a small amount of D uses the garbage collector. It's quite
            easy to write D code that doesn't use it.
            
            > in my opinion the boost shared pointers (later adopted into the
            standard) solved and shut the door on memory leaks as a serious
            issue.
            
            Reference counting is slow and memory intensive.
       
          bnolsen wrote 1 day ago:
          Regarding ruby and python I thought the 2 were in the same league,
          esp compared to perl. Over 20 years ago I evaluated both and went
          ruby because of the more consistent api and of course pythons forced
          whitespace is an easy tie breaker against it. At this point I'm not
          to pleased that many younger programmers that python as some sort of
          default and tend to end up writing far too fancy code in it when it
          ends up being the wrong tool.
       
            Shorel wrote 14 hours 28 min ago:
            Performance matters (as long as most other things are the same).
            
            Python won over Ruby because of performance. Ruby is easily the
            slowest of all mainstream languages.
       
          pjmlp wrote 1 day ago:
          What pains me in Python adoption, beyond its use as Perl replacement,
          is that we have so much better dynamic languages with advanced JIT
          implementations, but have to reach out writing extensions in native
          languages instead.
          
          At least Python as DSL for GPU JIT compilers is a thing now.
          
          Yes, I know about PyPy in the corner looking for attention.
       
            creata wrote 1 day ago:
            > we have so much better dynamic languages with advanced JIT
            implementations
            
            What are some of these better languages that you're referring to?
            (The usual dynamic language JITs I hear people praise are LuaJIT
            and Chez. And V8. And the JVM?)
       
              __s wrote 23 hours 15 min ago:
              Even Ruby has JIT now
       
                creata wrote 23 hours 0 min ago:
                True! But pjmlp was referring specifically to advanced JIT
                implementations, so I wondered which JITs he was referring to
                as advanced.
       
                  pjmlp wrote 13 hours 56 min ago:
                  In Ruby's case that would be RubyMotion, TruffleRubby and
                  JRuby.
                  
                  That trace back to Apple's efforts with MacRuby, or Sun's
                  (for a while Netbeans even had Ruby support).
       
                    ysleepy wrote 12 hours 36 min ago:
                    If you go that route, GraalPy is there too, so the argument
                    is not as strong as it seems.
       
                      pjmlp wrote 3 hours 40 min ago:
                      You missed my remark about PyPy feeling abandoned on the
                      corner, well the same applies to GraalPy.
                      
                      The Ruby JITs I mentioned are used in production.
                      
                      While other dynamic language comunities embrace their
                      JITs, in Python world, outside using it as a DSL for
                      GPGPU JITs, it is pretty much let's just keep using
                      CPythion with C and C++ extensions. Adding a JIT to
                      CPython only became a thing after Facebook and Microsoft
                      decided to push for its development.
       
              pjmlp wrote 1 day ago:
              Smalltalk, Self, whose research lead to Hotspot and V8, Common
              Lisp.
              
              And the usual, in Python everything is dynamic, well it is even
              more so in an image based live coding environment, where any
              break into the debugger, with code changes and resume execution
              can come back to a complete different world.
              
              Additionally there are features like Smalltalk become: message,
              where two objects can change places everywhere they are used in
              the image, and current execution.
       
              esafak wrote 1 day ago:
              I'd suggest F#, Clojure, Elixir, Scala, and TS, if that counts.
       
                kasajian wrote 4 hours 11 min ago:
                Clojure could never really be a thing since it ignores the most
                important rule: fast startup.  Because of this, and for no
                other reason, Clojure will always be an "also ran".  It's not
                about competency of the people working on it.  It's a solvable
                problem the community doesn't acknowledge exists, unless you
                press them on it, in which case they think "graal" and
                "babashka" is a valid response, and you're back to square 1.
       
          realharo wrote 1 day ago:
          Dart is much worse than TypeScript. The over-reliance on codegen for
          the most simple things (e.g. [1] ), the lack of expressiveness of the
          type system (it only got sum types very recently), and a lot of other
          little annoyances are ever present when having to write Dart.
          
   URI    [1]: https://pub.dev/packages/freezed#primary-constructors
       
          GoblinSlayer wrote 1 day ago:
          It's scary to not have type checks in JavaScript. I do them by
          eyeballing the code, but ugh.
          
          Also all languages you mentioned support complex code and OOP.
       
            vips7L wrote 1 day ago:
            Code can be complex in any language. TypeScript itself can produce
            some really complex types. OOP isn’t a bad thing either; it’s
            just a tool.
       
          zem wrote 1 day ago:
          speaking of typescript and dart, the language i was really rooting
          for in that niche was haxe. wish it had gotten more mainstream.
       
          ofrzeta wrote 1 day ago:
          It's quite subjective what you consider to be better. Is Ruby better
          than Python? Maybe so, but Ruby only ever had one killer app that is
          Rails while Python has a vast ecosystem. Is Crystal better than Go?
          Maybe so, but Go ist just so much more mature (plus the ecosystem
          argument).
       
          Demiurge wrote 1 day ago:
          >  Python preferred over Ruby
          
          ... Perhaps what you're describing is having a niche opinion. If you
          had some opinions, like a preference for "Everything must be done in
          as many ways as possible with funky characters" or "I hate
          indentation", it would certainly seem that the world is against you.
          But, perhaps, you just really smart and can remember the intention of
          all the complicated code you wrote a year ago, so you don't even need
          to write comments, and thats great. However, being special does not
          mean that some technolgoy is objectively inferior, unless you can
          actually come up with a provably objective metric.
          
          Overall, the technology that is there, solving most of the problems
          for most of the cases is the technology that is superior, by the law
          of the universe, not the other way around.
          
          I don't agree with any of your examples, but I have my own, like
          Pascal is a better language than C, by many metrics. I can also
          accept that C, is what people who invented unix, also invented. And
          that makes Pascal inferior to C, now, as choice for any project that
          requires that you hire embedded software developers. That's what the
          universe decided.
       
            kouteiheika wrote 1 day ago:
            > "Everything must be done in as many ways as possible with funky
            characters"
            
            Are you sure you're not talking about Perl here? Because there are
            very few "funky characters" in Ruby and code written in it tends to
            be very readable, more so than Python in many cases.
            
            I agree with OP. While Python is not a bad language, Ruby is a
            better language in general, and I'm reminded of it every time I
            have to work in Python (which is pretty often nowadays, due to
            Python's dominance in ML ).
            
            I can give many examples as to why, but here's a quick toy example
            to show off the difference in philosophy between Ruby and Python.
            You have a list of numbers, you want to keep only odd numbers, sort
            them, and convert them to a string where each number is separated
            by comma. Here's the Ruby code:
            
                xs = [12, 3, 5, 8, 7, 10, 1, 4]
                ys = xs.filter { |x| x.odd? }.sort.join(", ")
            
            Now let's do the same in Python:
            
                xs = [12, 3, 5, 8, 7, 10, 1, 4]
                ys = [x for x in xs if x % 2 != 0]
                ys.sort()
                ys = ", ".join(str(y) for y in ys)
            
            Or alternatively in a single line (but in more complex cases this
            gets extremely unwieldy since, unlike Ruby, Python forces you to
            nest these, so you can't write nice pipelines that read
            top-to-bottom and left-to-right):
            
                xs = [12, 3, 5, 8, 7, 10, 1, 4]
                ys = ", ".join(str(y) for y in sorted(x for x in xs if x % 2 !=
            0))
            
            And this matches my experience pretty well. Things I can do in Ruby
            in one line usually take two or three lines in Python, are more
            awkward to write and are less readable.
       
              Demiurge wrote 1 day ago:
              Ruby is in the running, so to speak, so of course that means
              there are thousands of people who agree with you. I'm not one of
              them. The fact that Ruby did not take of as much as Python did,
              even though there was all that RnR hype, is a testament to that.
              I don't think your examples are readable. What is |x| x.odd? ?
              (question mark pun intended) This is just "cleverness". I,
              personally, want my programming language to use method to use a
              keyword like "is" instead of operand?[question mark operator]
       
              abenga wrote 1 day ago:
              To a beginner who is used to ordinary imperative languages, that
              Ruby line is extremely difficult to understand. Is `.filter` a
              method or a property of `xs`? Is `{ |x| x.odd? }` an argument to
              a method or just a statement that comes after `xs.filter`? If it
              is passed to `.filter`, why does it not have parentheses around
              it but the `", "` passed to `join` does?
              
              This all makes sense to a person who knows the language a lot,
              but wrinkles the brain of a newcomer. Too many concepts to juggle
              in order to understand. On the other hand, the Python one reads
              quite easily, even if you may have to go right to left.
       
                creata wrote 1 day ago:
                The Ruby syntax doesn't seem that different to many other
                languages. For example:
                
                    xs.filter(x => x & 1).sort().join(", ") // JavaScript
                
                    xs & filter odd & sort & map show & intercalate ", " --
                Haskell
                
                Python seems to be the odd one out. Imo, its list
                comprehensions are confusing as hell to "newcomers". For
                example, when a list comprehension has multiple `for`s, what
                order are they nested in?
       
                  vram22 wrote 1 day ago:
                  >Python seems to be the odd one out. Imo, its list
                  comprehensions are confusing as hell to "newcomers". For
                  example, when a list comprehension has multiple `for`s, what
                  order are they nested in?
                  
                  The order is mentioned right in the docs, for Python 3: [1]
                  >Note how the order of the for and if statements is the same
                  in both these snippets.
                  
                  And it is mentioned even more clearly in corresponding
                  section in the Python 2 docs - last I checked, years ago,
                  
                  Update: IOW, the nested list comprehension syntax is
                  confusing only to newcomers or even experienced devs who are
                  lazy or stupid enough to not read the docs for the language
                  feature they want to use, before using it, IOW, "winging it",
                  whether to try to seem cool or due to peer pressure or other
                  reasons, all of which are stupid ones, even in the short
                  term, because the cost is higher than the benefit in most
                  cases.
                  
   URI            [1]: https://docs.python.org/3/tutorial/datastructures.ht...
       
                    creata wrote 1 day ago:
                    "RTFM" could excuse literally any syntax decision in any
                    language.
                    
                    The hostility in your response to "lazy or stupid" devs is
                    really funny given what a bad response it is.
       
                  quietbritishjim wrote 1 day ago:
                  > ... confusing as hell to "newcomers". For example, when a
                  list comprehension has multiple `for`s, what order are they
                  nested in?
                  
                  I get that this is just a rhetorical question to make a point
                  about newcomers, and I do agree it's not immediately obvious,
                  but for the record: you can imagine any "if"s and "for"s in a
                  list comprehension are nested statements in the same order.
                  So, for example, this:
                  
                     l = [
                        y.foo()
                        for x in my_list
                        if x.blah() > 7
                        for y in x.ys()
                     ]
                  
                  Is equivalent to this:
                  
                     l = []
                     for x in my_list:
                         if x.blah() > 7:
                         for y in x.ys():
                             l.append(y.foo())
                  
                  So the least comprehension is basically in left to right
                  order with the one exception of the actual expression to be
                  added to the list (like y.foo() in the example above).
       
                    creata wrote 1 day ago:
                    Yeah, I know, I know. But I imagine many people would
                    mentally want to bracket [e for x in xs for y in ys] like
                    [(e for x in xs) for y in ys] and thus conclude that y is
                    the outer loop.
       
                  abenga wrote 1 day ago:
                  Those both seem a little bit more consistent than the Ruby
                  example, however. To understand the JS example for example,
                  you only need know that to call a method on an object, you do
                  `object.method(arguments)`, and this is chained in a
                  straightforward manner, with methods called on the returned
                  values left to right. Ditto for the Haskell example. Maybe
                  the Ruby one does the same thing, but even in this extremely
                  simple example, we still have two different ways of doing the
                  same thing.
                  
                  For Python, you don't really have to use list comprehensions
                  in the place of multiple for loops, you can sacrifice the
                  brevity afforded to write the same thing in a more easily
                  understandable fashion.
       
                kouteiheika wrote 1 day ago:
                > To a beginner who is used to ordinary imperative languages,
                that Ruby line is extremely difficult to understand.
                
                I don't understand this argument. You are a beginner only for a
                tiny fraction of your time using a given programming language.
                Why are we optimizing a programming language for people who
                don't know it, instead of optimizing it for people who actually
                program in it?
       
                  abenga wrote 1 day ago:
                  >  Why are we optimizing a programming language for people
                  who don't know it, instead of optimizing it for people who
                  actually program in it?
                  
                  Everyone who actually programs in a language was once a
                  person who didn't know it. Languages which optimize for
                  succinct terseness might be powerful once you master them,
                  but they will never enter mainstream use, which I guess is
                  not necessarily the aim.
       
                usrbinenv wrote 1 day ago:
                The only difficulty in Ruby code is the block notation. Even
                then, it is very similar to constructs in JavaScript, Go, D and
                a number of other languages -- the only difference form JS
                would be that instead of `(x) => ...` you write `{ |x| ... }`.
                
                Questions such as
                
                > why does it not have parentheses around it but the `", "`
                passed to `join` does?
                
                would be exactly the same for JavaScript, Go or D. Ruby has the
                best syntax with regards to blocks/lambdas/closures.
       
                  Qem wrote 1 day ago:
                  > Ruby has the best syntax with regards to
                  blocks/lambdas/closures.
                  
                  A bit of Smalltalk shining through Ruby.
       
                  abenga wrote 1 day ago:
                  I don't know much Ruby outside of a few toy examples I wrote
                  a long time ago. For most languages, there would be
                  parentheses around objects you pass to functions, like
                  `.filter({|x| x.odd? })`. This lends some consistency and
                  makes it easy (for me at least) to understand that an
                  anonymous function is passed to `filter`. Just separating it
                  using spaces feels like Bash, something I find difficult to
                  write anything slightly complicated in.
       
                    creata wrote 1 day ago:
                    Lua, Haskell, ML, plenty of other languages where
                    one-argument functions don't need parentheses. I think it
                    makes a lot of code more readable.
       
                      abenga wrote 1 day ago:
                      All not-exactly-popular languages.
       
                        creata wrote 1 day ago:
                        Maybe relative to juggernauts like C or Java. But Lua
                        is pretty widely used.
       
                          Defletter wrote 1 day ago:
                          Kotlin too
       
          old-gregg wrote 1 day ago:
          Languages do not matter as much as you think. Ecosystems are
          everything. Twice in my life I started companies (the first one took
          all my life savings) and in both cases the right call was what you
          called an "inferior language".
          
          I actually liked D very much, and WB had been a personal hero of mine
          when I was in college. But I am not betting my career on an ecosystem
          built around by a single brilliant guy. For high-stakes projects, a
          wise decision is building on a platform with several deep-pocketed
          backers.
          
          And for toy/personal projects... do you even need a language anymore?
          Just ask your favorite LLM to generate you an executable which does
          what you want (partially joking here).
       
            pjmlp wrote 1 day ago:
            I belive asking the favorite LLM to generate an executable will be
            the future, just like high level languages drove Assembly
            development into a niche.
            
            Yes it isn't here today, just like it took several decades for
            optimizing compiler backends to do a very good job.
            
            In fact one of the reasons why Matt Goldbolt created Compiler
            Explorer was to have a way to settle arguments he was having in the
            games industry.
       
              Koshkin wrote 1 day ago:
              > LLM to generate an executable
              
              ... and the job of a programmer will be to explain, in as precise
              terms as possible, what they need the executable to do. (Reminds
              me of the idea of programming based on a natural language.)
       
                pjmlp wrote 1 day ago:
                Grace Hopper would find the future of programming so ironic.
       
            WalterBright wrote 1 day ago:
            D's ImportC feature makes it super easy to access C libraries from
            D code. That means D fits right in with a C ecosystem, as it's no
            longer necessary to attempt to translate the .h files into D.
            
            It's not perfect, as some people cannot resist using the C
            preprocessor for some bizarre constructions.
            
            I used to write those bizarre things myself in C, and was proud of
            my work. But one day I decided to remove them all, and the code was
            better.
       
              zerr wrote 1 day ago:
              Any plans to implement Swift like C++ interop?
       
                WalterBright wrote 1 day ago:
                D can do C++ interop when the C++ code is "C with classes"
                style. Some templates are supported. But then things get so
                complicated with C++ that it's impractical to go further.
       
              giancarlostoro wrote 1 day ago:
              One area where Go, C# and Rust beat D is packages in a few
              different ways.
              
              For C# Microsoft eventually embraced NuGet their package manager,
              and used it to put core packages that don't need to be fully
              available OOTB but can then benefit from frequent updates on a
              per project basis as opposed to updating the entire language
              runtime.
              
              For Go it was the out of the box packages, like if I want to make
              a website, I can pull in net/http and their templating packages
              that come out of the box with Go, maybe a reasonably simple core
              maintainer package or packages that go into Dub would be a strong
              selling point. Right now Vibe.d is the only option for web dev,
              but there's no reason a much simpler web server couldn't exist.
              
              For Rust, I just really love Cargo, I think its one of the nicest
              package managers I've ever used.
              
              The other thing that would really help D is if something
              significant is built around D, whether it be a framework (like
              what Rails did for Ruby) or some major application that needs D
              to function at its core and is used by many, this could be a
              groundbreaking modern IDE, or anything really, a database that
              uses the best bits and pieces of D to scale, or even a really
              rich cross-platform GUI stack (my kingdom for std.gui to be a
              thing in D, and reasonably exhaustive).
              
              I wish I had unlimited time and money, I would invest it in D.
              Alas, I'm not a language maintainer, just a guy who loves really
              good tools.
       
              kev009 wrote 1 day ago:
              It seems like the parent was trying to paint a situation of you
              being a bottleneck to success.    It seems a bit Schrödinger's
              BFDL though.. is Linus a bottleneck to the most used server
              operating system?  Did Guido hold back Python?    The existence of
              the GDC and LDC compilers torpedoes toolchain concerns.. I'd be
              more worried about Java or Golang suffering from some eventual
              corporate buffoonery.
              
              To the parent's point of startups, betting the farm on something
              like a particular language out of some sense of superiority might
              mean you are not focusing on the right problems.  But if the
              founders happen to know a less widely used tool it doesn't seem
              inappropriate either.  The type of employee that can drive a
              startup or a big tech project forward is not going to be thwarted
              by a language, and they might find something new to learn fun.
       
              ofrzeta wrote 1 day ago:
              It would be great if D supported something like OpenAPI generator
              [1] Maybe it exists and I am just ignorant but it doesn't seem to
              be in the list of supported languages.
              
   URI        [1]: https://github.com/OpenAPITools/openapi-generator
       
          esafak wrote 1 day ago:
          
          
   URI    [1]: https://en.wikipedia.org/wiki/Worse_is_better
       
        zascrash wrote 1 day ago:
        D deserves more recognition. It's a cool language under the radar for
        too long. I wish a major corporation backed it. I had a great time
        learning D. Also I admire Walter Bright If I could achieve even a
        fraction of his productivity, that would be awesome.
       
          creata wrote 1 day ago:
          Sincere question, not meant to be a shallow dismissal: Where is D a
          better choice than C++? In what aspects is it enough of an
          improvement over C++ to justify using a niche language?
       
            Neku42 wrote 1 day ago:
            Programming in D after C++ is like the opposite of death by 1000
            cuts - its just a constant stream of finding nice little things
            that simplify your life or avoid footguns. You become accustomed to
            all the niceties very fast and its hard to justify going back haha.
            
            D is by no means perfect (and over the years it has accumulated
            lots of warts) but if you know what you are doing it enables
            amazing productivity and almost never gets in your way. If you have
            an idea about solving a problem in a particular way there's almost
            always a path available to do just that without running into
            "computer says no" situations (stares at Go).
       
            acehreli wrote 1 day ago:
            D is technically better than C++ in most features. (It has always
            lead C++. For example, among about 100 new feauters that C++11
            brought, only 2 were not already in D. No C++ designer will ever
            admit this fact.)
            
            D is safer and more productive. It's a joy to write in D because
            most of the time it feels like whatever you think, you code. This
            is unlike C++ where you fight the language all the time. C++ is not
            a productive programming language. I say this with experience: I
            coded in C++ as an "expert" for many many years, including these
            last couple of years. It's not fun to write in C++, which
            translates to another kind of loss of productivity.
            
            C++ is a burden and liability for companies but no CTO will be
            blamed for chosing it because it's popular. I can list so many
            popular things and persons that worth nothing but I will refrain
            from getting political.
            
            Yes, on paper, there are way more C++ programmers out there than D
            programmers. But I interview these C++ programmers occasionally.
            Most of them don't even have an inkling that they don't know C++ at
            all.
            
            How about engineering with C++? That is such a difficult task. I
            went over header file hygiene with a colleague a couple of months
            ago. The number of points that you should pay attention to is mind
            boggling: Don't #include unnecessarily, do forward declare as much
            as possible (but what can be forward declared is hard to understand
            even for experienced programmers), #include your own API header
            first to prove that it's complete (and good luck!), don't forget
            header guards, don't reuse header guards, etc. etc. This is just
            efficient header file usage! We haven't started coding yet!
            
            My friends, the emperor doesn't have clothes. C++ simply is not a
            tool that is designed well. People who choose it do so because they
            have to or they are masochists. (True story: I asked a relatively
            young Google meetup presenter once why he was using C++ instead of
            a modern language and he said "because it is hard".) C++ separates
            the elite from the masses; I used to strive to be a C++ elite; I am
            not interested a bit anymore; I want to write useful programs with
            D; and I do.
            
            D is niche only because humans are populists. We are not encouraged
            to use tools (or products) that are designed better. We follow
            popular leaders. It takes one some time to find his or her own
            voice to reject bad products and use only good ones. I am extremely
            lucky to work for a company that allows me to use D to write useful
            products.
            
            I still take the same joy from programming that I did when I first
            learned it.
            
            Then there is the human aspect of it: I want to be associated with
            real people isntead of snobby elites. (Remember how C++ was
            marketed at around 2000? "Yes, C++ is hard but it was never meant
            to be for normal programmers anyway." Ha ha ha! I am old enough now
            to reject that mentality. Bad design is bad design my friends; you
            can't defend it by blaming the user for not being elite.)
            
            I can go on and on...
            
            Now it's my turn to ask: Why would anyone choose C++ for their
            projects despite the production costs that it brings? None of your
            programmers really know it; they introduce hidden liabilities in
            the projects, their source code become non-refactorable monsters.
            Why waste that money on C++ when you can produce products easily.
            Products that just work...
       
              monkeyelite wrote 1 day ago:
              I actually don’t think C++98 was that bad or complex. Yes
              nobody knew how to use it and wrote Java instead, but I think the
              hate comes from having code spanning so many different features
              and idioms that also require a compiler expert to understand.
       
              creata wrote 1 day ago:
              > Why would anyone choose C++ for their projects despite the
              production costs that it brings?
              
              Familiarity, and all the libraries and tools available for C++. I
              see that D has a section on C++ interop,[0] but it looks about as
              painful as FFI usually is, and even more painful given how
              template-heavy C++ code tends to be.
              
              (Completely unrelated: I can't mention FFI without also
              mentioning how amazing LuaJIT's C FFI is. The developer(s) really
              nailed it.)
              
              [0]:
              
   URI        [1]: https://dlang.org/spec/cpp_interface.html
       
        shoozza wrote 1 day ago:
        Slightly off topic:
        Is D a good language for creating tiny windows or Linux executables?
        There is an upcoming game jam (4mb jam 2025) which gives extra points
        for game submissions <= 8KB.
        With c you can fit a window with graphics update in an executable of
        less than 900 bytes[0]. Granted it's using crinkler for linking which
        does some compression.
        
        0:
        
   URI  [1]: https://gist.github.com/ske2004/336d8cce8cd9db59d61ceb13c1ed50...
       
          monkeyelite wrote 1 day ago:
          Yes. Just use the “better C” mode
       
            mariusor wrote 1 day ago:
            ... which is not D any more though.
       
              monkeyelite wrote 1 day ago:
              What essential features are missing for you?
       
                mariusor wrote 1 day ago:
                For game development? I imagine having to use only structs but
                not classes would be something that forces a "non idiomatic D"
                experience. Dynamic arrays sound like something that's very
                useful for a game. I don't know, there are plenty of features
                that are incompatible with better C that makes D, D. Generally
                speaking, garbage collection would be the biggest in my
                opinion.
       
                  WalterBright wrote 1 day ago:
                  You can still use classes in BetterC - you just have to
                  allocate them yourself. D recently acquired "placement new"
                  which makes that more convenient.
       
                  monkeyelite wrote 1 day ago:
                  Yeah this person is asking how to make the smallest
                  executable. They don’t want garbage collection.
       
                    mariusor wrote 1 day ago:
                    Garbage collection was about what I would be missing. I
                    mentioned before what could be missing from OP's point of
                    view.
       
                      monkeyelite wrote 1 day ago:
                      Ok. I think the better C mode is cool and I think it’s
                      worth a try for his interest and project.
       
                        mariusor wrote 14 hours 34 min ago:
                        I fully agree with you, but I think that if you present
                        it as an option to somebody you should write a line or
                        two about the potential downsides, so they have a
                        better picture. Sorry if I was too abrupt in my
                        criticism of your post. :)
       
              WhereIsTheTruth wrote 1 day ago:
              It's like saying "C is no longer C if you don't link with libc",
              it just is not true at all, and honestly, a pretty stupid thing
              to say
       
                mariusor wrote 1 day ago:
                Instead of being an ass, maybe you can take the time to educate
                me why you think I'm wrong?
                
                I think that at least the garbage collection not being
                available qualifies my statement as somewhat being true. For
                game development, as it's closer to what grand-parent asked,
                classes not being usable would also be an issue...
       
        croemer wrote 1 day ago:
        Anything compiled with LDC2 >=1.29 (3y old) will immediately
        crash/segfault on macOS >=15.4
        
        A fix is on master/beta but will still take some time to be released.
        
   URI  [1]: https://github.com/dlang/dmd/issues/21126
       
        nerdralph wrote 1 day ago:
        I tried D several years ago, and liked the language.  I didn't stick
        with it because of the lack of libraries compared to perl, python, C++,
        etc.
       
        WalterBright wrote 1 day ago:
        Currently I'm working on adding an AArch64 code generator to the
        venerable dmd D compiler. It's fun as it's completely differernt from
        the X86_64. In some ways very clever and in some ways completely wacky.
       
        bachmeier wrote 2 days ago:
        Been a heavy user of the language since 2013. This book was very
        helpful at the time. I don't think it was a book at that time, though,
        more a lengthy collection of notes as I recall.
       
          acehreli wrote 2 days ago:
          Exactly. It really was a happy accident. I talked about it here:
          
   URI    [1]: https://dlang.org/blog/2016/06/29/programming-in-d-a-happy-a...
       
        acehreli wrote 2 days ago:
        Author here... AMA.
       
          usrbinenv wrote 1 day ago:
          I recently read almost the whole book in a week or so. It's excellent
          and I feel like I can write in D pretty well after reading it. Too
          bad that I most likely won't be writing in D, but, at least, I'm
          confident I can come back to it anytime and be up to speed if I ever
          need to. This book should be the goto for anyone who wishes to
          quickly learn the language.
       
          bsdooby wrote 2 days ago:
          Planning on an update? Some new features made it into the language (I
          think).
       
            acehreli wrote 2 days ago:
            All I need is another wave of motivation. I'm searching. :)
       
              bsdooby wrote 1 day ago:
              Looking forward to that swell :)
       
        bsdooby wrote 2 days ago:
        One of the best language reference manuals out there...
       
          bsdooby wrote 2 days ago:
          ...could need an update, though.
       
        jpecar wrote 2 days ago:
        Is D runtime still crashing when host has more than 128 cpu cores? I
        learned this the hard way ...
       
          alphaglosined wrote 1 day ago:
          Are you talking about "Issue 24254 - LDC crash on Epyc Bergamo"?
          
          That was fixed within the week, with a notification given that it had
          been sent to the reporter.
       
        kingbob000 wrote 2 days ago:
        Love D! I used it a bit in college when it was required for a
        programming language class. It's hard to justify using it nowadays
        though.
       
          bsdooby wrote 2 days ago:
          Utah Valley University? Or Romania, or Turkey? And why is D's usage
          hard to justify (because of Rust and/or contemporary C++)?
       
            kingbob000 wrote 1 day ago:
            Yes, UVU. And also yes. If I find myself needing something
            low-level and performant, I have a hard time justifying the ramp-up
            time required to use D since there is a near zero chance I would
            use it in my current or future employment. While that isn't always
            how I decide what technologies to use in my personal time, it
            definitely is a factor that tips the scales towards a more
            mainstream language
       
            acehreli wrote 2 days ago:
            Mike Shah has been using D for teaching software engineering at
            Northeastern University and Yale. Here is his DLang playlist:
            
   URI      [1]: https://www.youtube.com/playlist?list=PLvv0ScY6vfd9Fso-3cB...
       
              MikeShah wrote 2 days ago:
              We have also been using D for computer graphics and game
              programming as of this year! :D
       
                zerr wrote 1 day ago:
                Lecture videos or notes?
       
                  MikeShah wrote 19 hours 22 min ago:
                  YouTube series has tutorials, and course videos are on my
                  website. More slides and such will be posted on my website
                  otherwise.
       
                bsdooby wrote 1 day ago:
                Totally forgot about that; sorry Mike ;)
       
                  MikeShah wrote 19 hours 23 min ago:
                  No worries at all! :)
       
        Daunk wrote 2 days ago:
        I feel like D is such an underrated language.
       
          jadbox wrote 1 day ago:
          Just to add, I learned D in a day and finished most of project euler
          without needing to look up the manual. D is more "python" than python
          in that it makes coding very.
          
          IMHO, Zig is the closest thing to being D-esk (like with comptime),
          but it's still not a mainstream option yet.
       
            jadbox wrote 8 hours 37 min ago:
            * makes coding very straight forward. Most of the time I find what
            I needed in the language just using intuition.
       
          WalterBright wrote 2 days ago:
          We're not good at marketing! But we're very good at language
          ergonomics.
       
       
   DIR <- back to front page