Jump to page: 1 28  
Page
Thread overview
D as a Better C
Aug 23, 2017
Mike Parker
Aug 23, 2017
Moritz Maxeiner
Aug 23, 2017
Walter Bright
Aug 23, 2017
Walter Bright
Aug 23, 2017
SrMordred
Aug 23, 2017
sarn
Aug 24, 2017
Kagamin
Aug 23, 2017
Walter Bright
Aug 23, 2017
Moritz Maxeiner
Aug 23, 2017
Kagamin
Aug 23, 2017
Walter Bright
Aug 24, 2017
Parke
Aug 25, 2017
Kagamin
Aug 25, 2017
Suliman
Aug 25, 2017
Basile B.
Aug 25, 2017
Basile B.
Aug 25, 2017
Swoorup Joshi
Aug 25, 2017
Jolly James
Aug 25, 2017
Parke
Aug 28, 2017
Kagamin
Aug 28, 2017
Parke
Aug 29, 2017
Kagamin
Aug 30, 2017
Parke
Aug 30, 2017
Adam D. Ruppe
Aug 30, 2017
Parke
Aug 30, 2017
Kagamin
Aug 30, 2017
Kagamin
Sep 07, 2017
Kagamin
Aug 23, 2017
jmh530
Aug 23, 2017
Walter Bright
Aug 23, 2017
Walter Bright
Aug 23, 2017
Meta
Aug 23, 2017
jmh530
Aug 23, 2017
Walter Bright
Aug 23, 2017
jmh530
Aug 23, 2017
Moritz Maxeiner
Aug 23, 2017
Moritz Maxeiner
Aug 23, 2017
Walter Bright
Aug 23, 2017
Moritz Maxeiner
Aug 24, 2017
Kagamin
Aug 23, 2017
John Colvin
Aug 23, 2017
Walter Bright
Aug 23, 2017
yawniek
Aug 23, 2017
XavierAP
Aug 23, 2017
Walter Bright
Aug 23, 2017
Jonathan M Davis
Aug 23, 2017
sarn
Aug 24, 2017
H. S. Teoh
Aug 24, 2017
Jacob Carlborg
Aug 24, 2017
Walter Bright
Aug 24, 2017
Walter Bright
Aug 25, 2017
Mengu
Aug 24, 2017
jmh530
Aug 24, 2017
Swoorup Joshi
Aug 24, 2017
twkrimm
Aug 24, 2017
9il
Aug 24, 2017
Iain Buclaw
Aug 24, 2017
H. S. Teoh
Aug 24, 2017
12345swordy
Aug 30, 2017
Azi Hassan
Aug 30, 2017
Azi Hassan
Aug 30, 2017
Adam D. Ruppe
Sep 01, 2017
Azi Hassan
Aug 31, 2017
Claude
Sep 07, 2017
twkrimm
August 23, 2017
To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it!

The blog:

https://dlang.org/blog/2017/08/23/d-as-a-better-c/

Reddit:
https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/
August 23, 2017
On Wednesday, 23 August 2017 at 13:12:04 UTC, Mike Parker wrote:
> To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it!
>
> The blog:
>
> https://dlang.org/blog/2017/08/23/d-as-a-better-c/
>
> Reddit:
> https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/

Interesting article, though one thing that I'm confused by is

>> Hence D libraries remain inaccessible to C programs, and chimera programs (a mix of C and D) are not practical. One cannot pragmatically “try out” D by add D modules to an existing C program.

I've been mixing C and full D for a while now (on Linux) by either having the main C program call rt_init/rt_term directly (if druntime is linked in when building a mixed C/D application), or have Runtime.initialize/Runtime.terminate be called from D via some plugin_load/plugin_unload functionality when using D shared libraries.
Why is this not considered practical?
August 23, 2017
On 8/23/2017 6:28 AM, Moritz Maxeiner wrote:
> Interesting article, though one thing that I'm confused by is
> 
>>> Hence D libraries remain inaccessible to C programs, and chimera programs (a mix of C and D) are not practical. One cannot pragmatically “try out” D by add D modules to an existing C program.
> 
> I've been mixing C and full D for a while now (on Linux) by either having the main C program call rt_init/rt_term directly (if druntime is linked in when building a mixed C/D application), or have Runtime.initialize/Runtime.terminate be called from D via some plugin_load/plugin_unload functionality when using D shared libraries.
> Why is this not considered practical?

Because in order to add a D function as trivial as:

   int foo() { return 3; }

to a C program, now the C program has to link to druntime, and the program no longer has a small footprint. One of the reasons people use C is to get that small footprint. This has been a large barrier to C programs making use of D.

August 23, 2017
On Wednesday, 23 August 2017 at 13:12:04 UTC, Mike Parker wrote:
> To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it!
>
> The blog:
>
> https://dlang.org/blog/2017/08/23/d-as-a-better-c/
>
> Reddit:
> https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/

Great piece.

It might be useful to beef up the documentation on some of the things that betterC changes. For instance, here
http://dlang.org/dmd-windows.html#switch-betterC
links to TypeInfo, which has like one line of explanation of what it's for, and ModuleInfo isn't linked to at all (and I'm still a little unclear on what that does).
August 23, 2017
On 8/23/17 10:00 AM, Walter Bright wrote:
> On 8/23/2017 6:28 AM, Moritz Maxeiner wrote:
>> Interesting article, though one thing that I'm confused by is
>>
>>>> Hence D libraries remain inaccessible to C programs, and chimera programs (a mix of C and D) are not practical. One cannot pragmatically “try out” D by add D modules to an existing C program.
>>
>> I've been mixing C and full D for a while now (on Linux) by either having the main C program call rt_init/rt_term directly (if druntime is linked in when building a mixed C/D application), or have Runtime.initialize/Runtime.terminate be called from D via some plugin_load/plugin_unload functionality when using D shared libraries.
>> Why is this not considered practical?
> 
> Because in order to add a D function as trivial as:
> 
>     int foo() { return 3; }
> 
> to a C program, now the C program has to link to druntime, and the program no longer has a small footprint. One of the reasons people use C is to get that small footprint. This has been a large barrier to C programs making use of D.
> 

Nope.

Stevens-MacBook-Pro:testd steves$ cat testdfunc.d
extern(C) int foo() { return 3; }
Stevens-MacBook-Pro:testd steves$ cat testdfunc_c.c
#include <stdio.h>
extern int foo();

int main()
{
    printf("%d\n", foo());
}
Stevens-MacBook-Pro:testd steves$ dmd -c testdfunc.d
Stevens-MacBook-Pro:testd steves$ gcc -o testdfunc testdfunc_c.c testdfunc.o
Stevens-MacBook-Pro:testd steves$ ./testdfunc
3


It's only if you do something that needs the runtime, such as static ctors, or use the GC.

-Steve
August 23, 2017
On 8/23/2017 7:01 AM, jmh530 wrote:
> ModuleInfo isn't linked to at all (and I'm still a little unclear on what that does).

That's because ModuleInfo doesn't appear in the online documentation due to having a malformed Ddoc comment. I fixed it here:

  https://github.com/dlang/druntime/pull/1906

but nobody has pulled it.
August 23, 2017
On Wednesday, 23 August 2017 at 14:01:30 UTC, jmh530 wrote:
> On Wednesday, 23 August 2017 at 13:12:04 UTC, Mike Parker wrote:
>> To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it!
>>
>> The blog:
>>
>> https://dlang.org/blog/2017/08/23/d-as-a-better-c/
>>
>> Reddit:
>> https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/
>
> Great piece.
>
> It might be useful to beef up the documentation on some of the things that betterC changes. For instance, here
> http://dlang.org/dmd-windows.html#switch-betterC
> links to TypeInfo, which has like one line of explanation of what it's for, and ModuleInfo isn't linked to at all (and I'm still a little unclear on what that does).

Walter has made a PR to improve the ModuleInfo documentation: https://github.com/dlang/druntime/pull/1906
August 23, 2017
On 8/23/17 10:11 AM, Walter Bright wrote:
> On 8/23/2017 7:01 AM, jmh530 wrote:
>> ModuleInfo isn't linked to at all (and I'm still a little unclear on what that does).
> 
> That's because ModuleInfo doesn't appear in the online documentation due to having a malformed Ddoc comment. I fixed it here:
> 
>    https://github.com/dlang/druntime/pull/1906
> 
> but nobody has pulled it.

Looks like there are some outstanding requests to be fulfilled before it's pulled.

-Steve
August 23, 2017
On Wednesday, 23 August 2017 at 14:00:34 UTC, Walter Bright wrote:
> On 8/23/2017 6:28 AM, Moritz Maxeiner wrote:
>> 
>> I've been mixing C and full D for a while now (on Linux) by either having the main C program call rt_init/rt_term directly (if druntime is linked in when building a mixed C/D application), or have Runtime.initialize/Runtime.terminate be called from D via some plugin_load/plugin_unload functionality when using D shared libraries.
>> Why is this not considered practical?
>
> Because in order to add a D function as trivial as:
>
>    int foo() { return 3; }
>
> to a C program, now the C program has to link to druntime, and the program no longer has a small footprint. One of the reasons people use C is to get that small footprint. This has been a large barrier to C programs making use of D.

Thank you, are there other factors involved, or is it only impractical for people who require minimal application size / memory footprint, then?
August 23, 2017
On 8/23/17 9:12 AM, Mike Parker wrote:
> To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it!
> 
> The blog:
> 
> https://dlang.org/blog/2017/08/23/d-as-a-better-c/
> 
> Reddit:
> https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/

How do dynamic closures work without the GC?

Nice article, BTW.

-Steve
« First   ‹ Prev
1 2 3 4 5 6 7 8