Dlang is C (pretty much)

RSY rsy_881 at gmail.com
Fri Dec 18 08:38:19 UTC 2020


On Thursday, 17 December 2020 at 23:07:27 UTC, Manu wrote:
> On Thu, Dec 17, 2020 at 4:45 PM Jessica Smith via Digitalmars-d 
> < digitalmars-d at puremagic.com> wrote:
>
>> I'm a python programmer closing in on 5 years of working with 
>> the language. I've dabbled in a fair number of other languages 
>> but Ive always come back to python.
>>
>> I have some experience working with c, but that's only through 
>> college projects. I wanted to pick up another systems 
>> programming language. Something fast and close to the metal. I 
>> chose d.
>>
>> The first thing that struck me as a potential pain point was 
>> the fact that d had very few libraries. It's community is a 
>> bit unresponsive. Some might say even comatose.
>>
>> I wanted to start by implementing a DNS server. So I checked 
>> to see if there was a DNS library I could use. D didn't have 
>> one that would fit the bill. At this point, I was wondering if 
>> rust or nim would make more sense. I dismissed both those 
>> languages early on cause of their respective syntaxes. They 
>> are not aesthetically pleasing to me. Somehow, d made sense.
>>
>> Here's where things got interesting.
>>
>> There is an excellent c library called ldns which powers the 
>> drill cli. I wanted to use that. Here's how you do this in d:
>>
>> Write an equivalent d file that mimics the header file of the 
>> c library you want to call into.
>>
>> Call the function
>>
>> WTF! D doesn't need extensions cause you can just use the c 
>> ones. Suddenly it feels like d has all of the plugins in the 
>> world as opposed to like three barely maintained libraries.
>>
>> I wanted to speed up a python app at work. Primary motivation 
>> behind picking up another language. d can fit in and just work 
>> with python as if I had written an actual c extension library. 
>> I get optional gc, type checking and speed. This is hands-down 
>> the coolest thing I have experienced. Suddenly d makes a lot 
>> more sense.
>>
>>
>> https://wwwrouterlogin-net.com/ 
>> http://amped-ampedwirelesssetup.net/ 
>> https://tplinkwifinet-login.com/
>
>
> Hooray! That is indeed the goal of investing in C/C++ 
> compatibility. It's
> meant to be an enabler, and it's nice to be aware of anecdotal 
> cases where
> that occurs.
> It's often exclusively seen as using existing C stuff in your D 
> apps, but
> it's also the case that you can use D in gaps where C/C++ could 
> only fit
> previously (like your python extensions), the number of such 
> use cases is
> innumerable.
> To be fair, most languages have some form of extern(C), but we 
> have done a
> good job to make sure it's really useful and (mostly) easy.

That is very true, i myself use lot of C libraries because C 
ecosystem is huge

The only problem thought is it's not as easy and transparent as 
it could be: https://github.com/ldc-developers/ldc/issues/3627


More information about the Digitalmars-d mailing list