[HN Gopher] Introduction to Dlang [video]
       ___________________________________________________________________
        
       Introduction to Dlang [video]
        
       Author : WalterBright
       Score  : 121 points
       Date   : 2022-10-08 23:09 UTC (2 days ago)
        
 (HTM) web link (www.youtube.com)
 (TXT) w3m dump (www.youtube.com)
        
       | WalterBright wrote:
       | Ali is the author of "Programming in D".
        
         | JohnBerea wrote:
         | And Walter ^ is the author of "D" itself : )
        
           | googlryas wrote:
           | And John Berea ^ wrote this comment
        
         | havandprohacker wrote:
         | I need a link
        
           | acehreli wrote:
           | http://ddili.org/ders/d.en/index.html
        
       | neverartful wrote:
       | I was just thinking about possibly using D for one of my personal
       | projects. The tricky part (for me) is the application needs AWS
       | S3 interoperability. Anyone cross that bridge with D? I did some
       | searching and didn't find any S3 libraries for D. Could D's
       | interoperability with other languages like C or C++ be used here
       | to make use of one of those libraries?
        
         | johannes1234321 wrote:
         | I wouldn't go the way via C or C++, but start by building a
         | thin wrapper over http libraries. In the end what these are are
         | rest apis.
        
           | neverartful wrote:
           | I know what you're saying, and I'm often inclined to do that,
           | but in the case of S3 it's a heck of a lot of work/time. Have
           | rolled my own for smaller APIs though.
        
         | WalterBright wrote:
         | > Could D's interoperability with other languages like C or C++
         | be used here to make use of one of those libraries?
         | 
         | That's what the interoperability is for!
        
           | neverartful wrote:
           | Cool! I might have to give it a try.
        
       | NickNaraghi wrote:
       | go huskies! :-)
        
       | mealkh wrote:
       | Very cool to see this gaining traction, my favourite hedgefonds-
       | I-never-got-to-work-at introduced D to me and I believe it's one
       | of the more interesting projects in languages right now.
        
       | p0nce wrote:
       | Made a few examples here to kickstart D usage:
       | https://github.com/p0nce/DIID
        
         | vram22 wrote:
        
       | synergy20 wrote:
       | how is D different from C/c++/rust/zig for system programming?
       | what's the major selling point? is it good for embedded(no GC)
       | use cases? what stopped it from becoming universally used?
        
         | acehreli wrote:
         | > how is D different
         | 
         | I don't know Zig yet.
         | 
         | I had an opinion long time ago that nobody should use C
         | anymore; I would suggest C++ at least because it has
         | constructors and templates. D's [Better
         | C](https://dlang.org/spec/betterc.html) would be my go-to at
         | this time.
         | 
         | C++ is getting better but it's still very difficult to get
         | right: It depends mainly on programmer attention e.g. to follow
         | 400+ [guidelines](https://isocpp.github.io/CppCoreGuidelines/Cp
         | pCoreGuidelines).
         | 
         | Rust is "different" but it has the borrow checker as a safety
         | tool. D's [live functions](https://dlang.org/spec/ob.html) and
         | other [memory
         | safety](https://dlang.org/blog/2022/10/08/dip1000-memory-
         | safety-in-a...) features are closing the gap there.
         | 
         | > major selling point
         | 
         | I am copying slide 59 here: D provides competitive advantage by
         | helping happy programmers produce correct programs
         | pragmatically.
         | 
         | Slide 8 lists what D does _not_ have, which can explain why D
         | has not gained popularity that it deserves. For example, nobody
         | can sell D as  "Google's language" or "Apple's language".
        
           | synergy20 wrote:
           | makes sense, thanks!
        
           | no_wizard wrote:
           | Is there a way to enable safe "D" by default, rather than
           | using the `@safe` (what looks to be) modifier?
        
             | acehreli wrote:
             | No. We had a very long discussion about safe-by-default on
             | the forums but failed to reach a consensus.
             | 
             | As I understand it, for safe-by-default to work, either all
             | C libraries would have @trusted D bindings written, or all
             | of them would have to be assumed to be @trusted. Most of
             | the community wanted explicit @trusted annotations, Walter
             | and others favored assuming them to be @trusted (or was it
             | assumed @safe?) was the way to go. So, no safe-by-default
             | at this time. :/
        
             | gavinray wrote:
             | D-lang attributes can be used like a label, so for example
             | you can put at the top of your file:                  @safe
             | nogc:             auto myFunc() { // do stuff }
             | struct Blah {}
             | 
             | Whatever attributes you use apply to all code in the
             | lexical scope below the colon.
             | 
             | It's useful for structs/classes                 struct
             | MyThing {         auto unsafeFunc() {}
             | @safe:         auto safeFunc1() {}       }
        
         | Decabytes wrote:
         | > what stopped it from becoming universally used
         | 
         | D had a lot of momentum in the beginning, but the license
         | around the compiler scared away some people, then there was the
         | whole standard library split with phobos and tango (irrelevant
         | now and has been for over a decade), and from my understanding
         | in the beginning (I wasn't around during that time) Walter
         | added features by request as there wasn't a DIP process yet (D
         | improvement proposals), and some people felt it was unfair.
         | These have all been rectified.
        
           | Keyframe wrote:
           | There was also this whole D1 vs D2 where some of us (I was
           | involved with Tango) though D1 more of as a 'better C' (not
           | related to actual better C) and D2 more of as a better C++.
           | Personally, I was more interested in D1 direction. D took the
           | D2 route with Alexandrescu onboard at a time. The whole thing
           | then was also lacking support. Even if D was a better
           | language (D1 was, I guess D2 might be as well - haven't
           | dabbled in a decade with it), you had to do everything from
           | scratch. No libraries, abandoned bindings, etc.. instead of
           | doing work with it, you had to do the plumbing first. That's
           | true for most niche languages. Rust was like that as well,
           | but not seems to have a momentum going on for it and is
           | growing / has grown out of that phase D never did. D has been
           | around now what, 15-20 years? How sweet would it be for
           | someone of Walter's caliber to join the ranks of Rust team?
           | Dude is incredible, but D seems to be a dead end ultimately.
           | Sorry to sound so harsh, but it didn't happen on a scale it
           | needs, why would it now or ever?
        
           | synergy20 wrote:
           | so all problems are resolved (including compiler license)
           | then, I was curious about D but never looked into seriously,
           | now it seems about time.
           | 
           | anything safer than C, easier than c++ and rust is
           | interesting.
           | 
           | i will build some code and check out its memory usage and
           | binary size, both are important for embedded.
        
             | acehreli wrote:
             | > memory usage and binary size
             | 
             | Don't forget the -betterC compiler switch please. ;)
        
         | WalterBright wrote:
         | D is more capable as a systems programming language than C or
         | C++ is. Not only can you do whatever you like with pointers,
         | but it has a nice symbolic inline assembler, too. The code
         | generator is shared with C's and C++'s, so there is no
         | difference in code quality.
        
       | reil_convnet wrote:
       | This is a very well structured talk.
        
       | cassepipe wrote:
       | I don't know when I'll be using this language but I definitely
       | want to
        
       | no-dr-onboard wrote:
        
       | aaaaaaaaaaab wrote:
        
       | systems wrote:
       | I think its important to share few negatives about D
       | 
       | 1. It have no edge, its not the best system language, and far
       | from a good application language (mainly because of the eco
       | system)
       | 
       | 2. Fragile community, low number of user and the community forum
       | is toxic frequently
       | 
       | 3. It doesnt have strong leadership, D doesnt have a good
       | roadmap, and constantly changing vision
       | 
       | 4. Its a big language, and considering the drawbacks, its too big
       | to have such critical drawbacks
       | 
       | I cant really think of any solid reason, why anyone would invest
       | in D, except if they are already knee deep into it for some
       | historical reasons
       | 
       | D is not a horrible language, but today there are so many better
       | choices, and the language is too big, to risk investing in it
        
         | primeblue wrote:
        
         | enriquto wrote:
         | > the community forum is toxic frequently
         | 
         | I don't know what the word "toxic" means in your sentence, but
         | anyhow the D forums are one of my favourite websites on the
         | internet:
         | 
         | https://forum.dlang.org/group/general
         | 
         | Heck, I'm not even interested in the D language too much, but
         | these forums are so good that I browse them in awe at least
         | once per week. They are so responsive! I'm not even talking
         | about the contents, but about the website itself. An arrogantly
         | efficient showcase of what a good website can be.
        
         | destructionator wrote:
         | > the community forum is toxic frequently
         | 
         | what exactly does this mean?
        
           | bachmeier wrote:
           | It means people make posts like this poster has made here.
           | (This is an honest answer based on my experience.)
        
             | systems wrote:
             | actually this very accurate, but it doesnt make anything i
             | said less true or accurate
        
           | systems wrote:
           | tons of bikeshedding posts, ones that criticize D lack of
           | vision/focus and misfortune
        
             | acehreli wrote:
             | I heard Discord may have negative posts as well but I find
             | the official D newsgroups (with a forum interface) very
             | friendly and clean. Minimal moderation seems to help there.
        
               | gavinray wrote:
               | The Discord is quite nice, you should join =)
        
             | WalterBright wrote:
             | We moderate with a light touch to allow our users as much
             | freedom as we can. People can write negative and bikeshed
             | posts, and they can criticize me as much as they like. But
             | we do moderate posts that make personal criticisms of other
             | members, go off topic too far, or engage in unprofessional
             | behavior.
        
       | terminalcommand wrote:
       | Go Ali! When I was a little kid trying to get my feet wet with
       | programming, Ali used to write on a Turkish programming forum,
       | ceviz.net. He used to patiently answer all my questions. Since
       | then I learned English and got out of touch with the Turkish
       | community. I am surprised to see him on HN!
        
         | acehreli wrote:
         | Wonderful to see you here as well! :)
        
           | tomcam wrote:
           | How cool that you were so kind. World needs more people like
           | that.
        
             | CodeSgt wrote:
             | There are programmimg discord servers where I think most of
             | the kind and helpful programmers find themselves today. At
             | least, that's been my observation.
        
         | m00dy wrote:
         | Do you know Mr.Stop as well ? He 's almost old as Ali in
         | Turkish scene. He has been reversing bits and bytes though.
        
           | terminalcommand wrote:
           | I haven't come across him. He may have preceeded my time and
           | abilities at that time:). I hanged around in ceviz.net during
           | middle school, I guess around 2008-2010. Before that I was to
           | small to write code. My parents had bought me a Javascript
           | book and teach yourself c++ from Herbert Schildt from a local
           | bookstore. Javascript book was easy, C++ book was hard :). So
           | I abandoned the book shortly after learning cin, cout,
           | iostream and Ali was there to help me out write some
           | programs. I still remember this. I had written a basic
           | calculator in c++, insert number 1, insert operator, insert
           | number 2 kind of something. Ali wrote to me why don't you
           | write it so that it doesn't require you to enter seperate
           | inputs. That question lingered on my mind for a long time and
           | led me into learning about parsing and writing interpreters
           | years later.
        
       | Decabytes wrote:
       | I like programming in D. And I think that it can exist in a world
       | with Rust/Zig/Go/blub. My personal opinion/pitch for D.
       | 
       | 1. I found D pretty easy to learn and use so getting productive
       | in it was easier for me than Rust.
       | 
       | 2. D has a lot of improvements to C++ that make it more ergonomic
       | (no header files! built in package management!)
       | 
       | 3. D has a lot of flexibility to go up and down the stack in
       | complexity as well as interface with existing c/c++ code.
       | a. Need to use d for scripting like Python? use Rdmd
       | b. Need to interface with c code and can't depend on the D
       | compiler? use -betterC ^1            c. Need a quick and dirty
       | way to use C code without creating bindings? use importC
       | d. Can't use the garbage collector? use @nogc            e. Need
       | to interface with C++? use extern (C++)
       | 
       | D's flexibility is its greatest strength and weakness. It can do
       | a lot of things but not all of its features are ergonomic. A lot
       | of that just has to do with man power. If it had a community as
       | large as C++ things would be different. Using the examples in 3,
       | you could use Ds features and write a kernel with @nogc, a user
       | interface for that kernel using regular D, and create build
       | scripts using rdmd.
       | 
       | To see a c++ person perspective on D watch this video^2
       | 
       | 1. https://wiki.dlang.org/D_on_esp32/esp8266(llvm-
       | xtensa%2Bldc)...
       | 
       | 2. DConf '22: Ray Tracing in (Less Than) One Weekend with DLang
       | -- Mike Shah https://www.youtube.com/watch?v=nCIB8df7q2g
        
         | bachmeier wrote:
         | I use D to interface with C code and C APIs. Started using it
         | for that purpose in June 2013 and haven't looked back. Used
         | Rust and Go first, did not like either, and have been happy
         | using D ever since. Over time the interoperability with C has
         | gotten even stronger - to the point that you don't need to
         | write bindings for the most part, and you can even directly
         | compile C code as part of your project.
        
       | acehreli wrote:
       | AMA I am the speaker.
        
         | toxik wrote:
         | Did Rust eat your (the D community's) lunch?
        
           | acehreli wrote:
           | It is definitely chewing on it. :)
           | 
           | D's advantage over Rust is its familiar syntax and semantics.
           | C, C++, Java, C#, Python, etc. programmers feel at home once
           | they learn some differences. I heard others say "D is what
           | C++ should have been" and "Compiled Python".
           | 
           | I did use Rust for a brief period in a project where the
           | experienced Rust programmer among us was throwing '&'
           | characters here and there to make the code compile, seemingly
           | randomly in many cases. Personally, I remember fighting with
           | impedance issues with the many different string types of
           | Rust. All of this spells a steeper learning curve to me.
           | 
           | I think D is familiar to programmers of many other languages.
        
             | primeblue wrote:
        
             | glandium wrote:
             | The inconvenient truth about strings is that strings are
             | hard, and even Rust doesn't have enough string types.
        
               | WalterBright wrote:
               | D doesn't actually have string types, either, what it
               | does have is `string` is just an alias for:
               | const(char)[]
               | 
               | meaning you can treat it like any other array.
        
       ___________________________________________________________________
       (page generated 2022-10-11 23:00 UTC)