Google's take on memory safety
harakim
harakim at gmail.com
Sat Mar 16 18:47:40 UTC 2024
On Wednesday, 13 March 2024 at 19:18:20 UTC, bachmeier wrote:
> On Sunday, 10 March 2024 at 09:34:28 UTC, Emmanuel Danso Nyarko
> wrote:
>> On Sunday, 10 March 2024 at 04:24:15 UTC, Walter Bright wrote:
>>> On 3/9/2024 3:32 PM, Lance Bachmeier wrote:
>>>> I "ported" a few thousand lines of C to D in a couple hours
>>>> this afternoon. That includes the time it took to put all C
>>>> memory allocation inside SafeRefCounted. With the overhead
>>>> out of the way (setting up the SafeRefCounted structs,
>>>> testing, and some minor other things) I bet I could easily
>>>> port 20,000 lines in an 8-hour day. Working directly with C
>>>> macros was the last thing needed to make this go fast.
>>>
>>> Thanks for posting that, I enjoy such testimonials!
>>
>> What about we build maybe a strategy to send D out there! We
>> must let the world see the power of D.
>
> Show them working code. This is a separate project I did after
> the one I posted about in my previous comment.
>
> https://github.com/bachmeil/d-gslrng
>
> It took only a few hours and there's over 7000 lines of C.
> There are some nice features of this project:
>
> - I made zero changes to the C code. Now that we have macro
> support, every line in the C files was copied and pasted. That
> means I get to reuse the decades of testing done on this
> popular library.
> - I was able to strip out a small part of a much larger
> library. If I were calling into a C library, I'd be stuck with
> whatever they give me.
> - There's no shared library dependency. That means support for
> every OS out of the box. No bindings or wrappers. Aside from
> the previous comment about stripping out most of the library, I
> can make changes to the functions if I want. With a shared
> library you either use what they give you or you maintain your
> own fork in order to share your work with others.
I will admit that I didn't know what ImportC was all this time. I
started gleaning it must be something where you can easily port C
code and then thought it sounded like you could just use C code
in D. That seemed like a great goal, but obviously that couldn't
be it because D would be a lot more popular. Now you say this is
true!? This is such an enormous benefit! This should be a huge
driver for D. With this functionality, I could easily see it
being the language of the year on tiobe, for example. Good work D
team! I hope you can follow it up with some success in adoption.
More information about the Digitalmars-d
mailing list