www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - -betterC is amazing, make (/keep making) it more sophisticated!

reply Aedt <adnansignsup gmail.com> writes:
I've been playing with D for a while. I usually 
write/maintain/contribute to C and C++ applications for *nix. D 
is low key amazing, it has
- C standard library in the standard
- continually improving betterC idioms
- built in version blocks, unit test and debug blocks
- painless doc gen
- modules and painless dependency handling
- linter, formatting tool and suggestion tool independent of 
editors
Now if D manages all of the following it's going to be even 
better:
- complete porting the C99 compliant C compiler fornt end to the 
D compiler so you can seamlessly just import C headers (like C++)
- Improve shared library support

Don't know about other C programmers but if D grants me to write 
C with modules, doc gen and dep handling, I can switch any day! 
But I need to be able to use tons of C libraries without having 
to writing wrappers for them.

Thank you.
Mar 21 2018
next sibling parent reply Seb <seb wilzba.ch> writes:
On Wednesday, 21 March 2018 at 22:33:37 UTC, Aedt wrote:
 I've been playing with D for a while. I usually 
 write/maintain/contribute to C and C++ applications for *nix. D 
 is low key amazing, it has
 - C standard library in the standard
 - continually improving betterC idioms
 - built in version blocks, unit test and debug blocks
 - painless doc gen
 - modules and painless dependency handling
 - linter, formatting tool and suggestion tool independent of 
 editors
Thanks a lot for these kind words!
 Now if D manages all of the following it's going to be even 
 better:
 - complete porting the C99 compliant C compiler fornt end to 
 the D compiler so you can seamlessly just import C headers 
 (like C++)
I heard that Walter recently ported his DMC++ to D and I heard that someone was working on this, so chances aren't too bad that this might happen ;-)
 - Improve shared library support
What do you miss / are referring to?
 Don't know about other C programmers but if D grants me to 
 write C with modules, doc gen and dep handling, I can switch 
 any day! But I need to be able to use tons of C libraries 
 without having to writing wrappers for them.
Not sure whether you are aware of these two projects? https://github.com/jacob-carlborg/dstep (converts C headers to D headers auto-magically) https://github.com/Syniurge/Calypso (LDC fork which allows direct interfacing with C/C++ code) For my use cases dstep works nicely.
Mar 21 2018
next sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:
 I heard that Walter recently ported his DMC++ to D and I heard 
 that someone was working on this, so chances aren't too bad 
 that this might happen ;-)
You might check out Atila's github page (I don't think it's ready for release yet).
Mar 21 2018
parent reply Seb <seb wilzba.ch> writes:
On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote:
 On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:
 I heard that Walter recently ported his DMC++ to D and I heard 
 that someone was working on this, so chances aren't too bad 
 that this might happen ;-)
You might check out Atila's github page (I don't think it's ready for release yet).
For reference, I think jmh530 was referring to this: https://github.com/atilaneves/include
Mar 21 2018
parent reply Atila Neves <atila.neves gmail.com> writes:
On Thursday, 22 March 2018 at 00:24:34 UTC, Seb wrote:
 On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote:
 On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:
 I heard that Walter recently ported his DMC++ to D and I 
 heard that someone was working on this, so chances aren't too 
 bad that this might happen ;-)
You might check out Atila's github page (I don't think it's ready for release yet).
For reference, I think jmh530 was referring to this: https://github.com/atilaneves/include
That's the one. It's nearly ready to announce (although even by then there will be a loooot of work to do afterwards). Sneak peek, this works right now (yes, what's shown is, except for the #include directives, D code): #include "nanomsg/nn.h" #include "nanomsg/pubsub.h" void main() { const sock = nn_socket (AF_SP, NN_PUB); scope(exit) nn_close(sock); } As for the how/what/why/WTF/etc, stay tuned. Atila
Mar 22 2018
parent reply Aedt <adnansignsup gmail.com> writes:
On Thursday, 22 March 2018 at 10:45:50 UTC, Atila Neves wrote:
 On Thursday, 22 March 2018 at 00:24:34 UTC, Seb wrote:
 On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote:
 [...]
For reference, I think jmh530 was referring to this: https://github.com/atilaneves/include
That's the one. It's nearly ready to announce (although even by then there will be a loooot of work to do afterwards). Sneak peek, this works right now (yes, what's shown is, except for the #include directives, D code): #include "nanomsg/nn.h" #include "nanomsg/pubsub.h" void main() { const sock = nn_socket (AF_SP, NN_PUB); scope(exit) nn_close(sock); } As for the how/what/why/WTF/etc, stay tuned. Atila
Just out of sheer curiosity, will I be able to #include <pthread.h> or <gtk.h>?
Mar 22 2018
next sibling parent Atila Neves <atila.neves gmail.com> writes:
On Thursday, 22 March 2018 at 12:10:34 UTC, Aedt wrote:
 On Thursday, 22 March 2018 at 10:45:50 UTC, Atila Neves wrote:
 On Thursday, 22 March 2018 at 00:24:34 UTC, Seb wrote:
 [...]
That's the one. It's nearly ready to announce (although even by then there will be a loooot of work to do afterwards). Sneak peek, this works right now (yes, what's shown is, except for the #include directives, D code): #include "nanomsg/nn.h" #include "nanomsg/pubsub.h" void main() { const sock = nn_socket (AF_SP, NN_PUB); scope(exit) nn_close(sock); } As for the how/what/why/WTF/etc, stay tuned. Atila
Just out of sheer curiosity, will I be able to #include <pthread.h> or <gtk.h>?
I'll have failed if you're not able to. If it doesn't work, it's a bug. Atila
Mar 22 2018
prev sibling parent Seb <seb wilzba.ch> writes:
On Thursday, 22 March 2018 at 12:10:34 UTC, Aedt wrote:
 On Thursday, 22 March 2018 at 10:45:50 UTC, Atila Neves wrote:
 On Thursday, 22 March 2018 at 00:24:34 UTC, Seb wrote:
 On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote:
 [...]
For reference, I think jmh530 was referring to this: https://github.com/atilaneves/include
That's the one. It's nearly ready to announce (although even by then there will be a loooot of work to do afterwards). Sneak peek, this works right now (yes, what's shown is, except for the #include directives, D code): #include "nanomsg/nn.h" #include "nanomsg/pubsub.h" void main() { const sock = nn_socket (AF_SP, NN_PUB); scope(exit) nn_close(sock); } As for the how/what/why/WTF/etc, stay tuned. Atila
Just out of sheer curiosity, will I be able to #include <pthread.h> or <gtk.h>?
I'm not sure whether you are aware, but D pthread "header" are shipped with DRuntime as core.sys.posix.pthread: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/pthread.d
Mar 22 2018
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 3/21/2018 3:48 PM, Seb wrote:
 I heard that Walter recently ported his DMC++ to D
Yes, indeed: https://github.com/DigitalMars/Compiler I want to convert the back end to D, too, but am blocked by https://github.com/dlang/dmd/pull/7714 Seb, can you help with that?
Mar 21 2018
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:

 Not sure whether you are aware of these two projects?

 https://github.com/jacob-carlborg/dstep (converts C headers to 
 D headers auto-magically)

 https://github.com/Syniurge/Calypso (LDC fork which allows 
 direct interfacing with C/C++ code)

 For my use cases dstep works nicely.
Quite old now and a proof of concept, DStep embedded into the compiler: https://github.com/jacob-carlborg/dmd/commit/2837d340c065cc2bf3f0a83cb96c4d9f22fb3a30 -- /Jacob Carlborg
Mar 22 2018
prev sibling parent reply Radu <void null.pt> writes:
On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:
 On Wednesday, 21 March 2018 at 22:33:37 UTC, Aedt wrote:
 I've been playing with D for a while. I usually 
 write/maintain/contribute to C and C++ applications for *nix. 
 D is low key amazing, it has
 - C standard library in the standard
 - continually improving betterC idioms
 - built in version blocks, unit test and debug blocks
 - painless doc gen
 - modules and painless dependency handling
 - linter, formatting tool and suggestion tool independent of 
 editors
Thanks a lot for these kind words!
 Now if D manages all of the following it's going to be even 
 better:
 - complete porting the C99 compliant C compiler fornt end to 
 the D compiler so you can seamlessly just import C headers 
 (like C++)
I heard that Walter recently ported his DMC++ to D and I heard that someone was working on this, so chances aren't too bad that this might happen ;-)
 - Improve shared library support
What do you miss / are referring to?
 Don't know about other C programmers but if D grants me to 
 write C with modules, doc gen and dep handling, I can switch 
 any day! But I need to be able to use tons of C libraries 
 without having to writing wrappers for them.
Not sure whether you are aware of these two projects? https://github.com/jacob-carlborg/dstep (converts C headers to D headers auto-magically) https://github.com/Syniurge/Calypso (LDC fork which allows direct interfacing with C/C++ code) For my use cases dstep works nicely.
Would be nice to have a facility to generate C headers from a module, ala' `-H` but instead of generating D .di to generate C compilable .h files. I find it tedious to manually generate those, so for some projects I use some template magic and pragma(msg, ...) to generate a bunch of defines/declarations, but having it build in into the compiler would make it even better!
Mar 22 2018
parent reply Seb <seb wilzba.ch> writes:
On Thursday, 22 March 2018 at 15:42:54 UTC, Radu wrote:
 On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote:
 On Wednesday, 21 March 2018 at 22:33:37 UTC, Aedt wrote:
 [...]
Thanks a lot for these kind words!
 [...]
I heard that Walter recently ported his DMC++ to D and I heard that someone was working on this, so chances aren't too bad that this might happen ;-)
 [...]
What do you miss / are referring to?
 [...]
Not sure whether you are aware of these two projects? https://github.com/jacob-carlborg/dstep (converts C headers to D headers auto-magically) https://github.com/Syniurge/Calypso (LDC fork which allows direct interfacing with C/C++ code) For my use cases dstep works nicely.
Would be nice to have a facility to generate C headers from a module, ala' `-H` but instead of generating D .di to generate C compilable .h files. I find it tedious to manually generate those, so for some projects I use some template magic and pragma(msg, ...) to generate a bunch of defines/declarations, but having it build in into the compiler would make it even better!
FYI: There were a few efforts to attempt this, e.g. https://github.com/dlang/dmd/pull/5082 https://github.com/dlang/tools/pull/39 https://issues.dlang.org/show_bug.cgi?id=9285 In short: it's a bit complicated and no one has managed to get it to the finish line so far. However, with DMD's new DUB package this might be possible to do without needing to be added to dlang/dmd and can start to grow as a separate project.
Mar 22 2018
parent Radu <void null.pt> writes:
On Thursday, 22 March 2018 at 16:03:14 UTC, Seb wrote:
 On Thursday, 22 March 2018 at 15:42:54 UTC, Radu wrote:
 [...]
FYI: There were a few efforts to attempt this, e.g. https://github.com/dlang/dmd/pull/5082 https://github.com/dlang/tools/pull/39 https://issues.dlang.org/show_bug.cgi?id=9285 In short: it's a bit complicated and no one has managed to get it to the finish line so far. However, with DMD's new DUB package this might be possible to do without needing to be added to dlang/dmd and can start to grow as a separate project.
OK, I guess it make sense to have it as an external tool that's based on the dmdlib. Thanks for the pointers.
Mar 23 2018
prev sibling parent John Belmonte <john neggie.net> writes:
On Wednesday, 21 March 2018 at 22:33:37 UTC, Aedt wrote:
 - C standard library in the standard
I noticed that core.stdc.math is missing M_PI and similar constants. Before -betterC I imagine it was considered sufficient that the constants are in phobos. Would anyone else like to see these added?
Mar 22 2018