April 10, 2018
On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote:
>> If you get to the point where you can #include <vector>, it will be doubly impressive!
>
> Not *if*, *when*. ;)
>
> Atila

FYI people have been fighting with this for a long time:

https://github.com/dlang/druntime/pull/1316
April 10, 2018
On Tuesday, 10 April 2018 at 20:32:05 UTC, Seb wrote:
> On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote:
>>> If you get to the point where you can #include <vector>, it will be doubly impressive!
>>
>> Not *if*, *when*. ;)
>>
>> Atila
>
> FYI people have been fighting with this for a long time:
>
> https://github.com/dlang/druntime/pull/1316

FYI this appears to work just fine in Calypso: https://github.com/Syniurge/Calypso/blob/master/tests/calypso/libstdc%2B%2B/vector.d

 — David
April 10, 2018
On Tuesday, 10 April 2018 at 20:32:05 UTC, Seb wrote:
> On Tuesday, 10 April 2018 at 16:51:57 UTC, Atila Neves wrote:
>>> If you get to the point where you can #include <vector>, it will be doubly impressive!
>>
>> Not *if*, *when*. ;)
>>
>> Atila
>
> FYI people have been fighting with this for a long time:
>
> https://github.com/dlang/druntime/pull/1316

The beauty of using libclang is that name mangling issues don't exist. :)

It's still not going to be easy, but that's one worry I won't have to bother with.

Atila
April 11, 2018
On 09/04/2018 11:03 PM, Atila Neves wrote:
> Here's my blog post about my project that allows directly #including C headers in D*
> 
> https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ 
> 
> 
> The summary is that, modulo bugs, things like this work:
> 
>      #include <stdio.h>
>      void main() { printf("Hello world\n".ptr); }
> 
> So far it's successfully compiled whilst #including pthread, libcurl, openssl and others. The blog and the github README have more information, and feel free to reply to this with questions.
> 
> dub: http://code.dlang.org/packages/dpp
> reddit: https://www.reddit.com/r/programming/comments/8axj53/include_c_headers_in_d_code/ 
> 
> hacker news: It's in there somewhere, search around.
> 
> Atila
> 
> * Technically, "D + #include directives + C macros"

Any chance objectice-c as well?
April 11, 2018
On Tuesday, 10 April 2018 at 23:44:46 UTC, Atila Neves wrote:

> The beauty of using libclang is that name mangling issues don't exist. :)

How is that not going to be an issue? Are you adding `pragma(mangle)` everywhere?

--
/Jacob Carlborg
April 11, 2018
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote:
> Here's my blog post about my project that allows directly #including C headers in D*
>
> https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/

How do you deal with macros containing invalid D code, i.e. `#define foo(T) sizeof(T)`?

--
/Jacob Carlborg

April 11, 2018
On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote:
> If you add to all that "No, really, it's ok, there's this project that forked one of the compilers. No, it's not the reference compiler. There's just this bit of non-standard syntax to learn that's neither C nor D", then the chances of convincing any "normal" engineer are 0.

It is the reference compiler though (which is the frontend), the backend is different, but they don't want the dmc backend do they? Also recently it started to use pragma and import syntax, which are both D.
April 11, 2018
On Wednesday, April 11, 2018 09:23:29 Kagamin via Digitalmars-d-announce wrote:
> On Monday, 9 April 2018 at 19:36:23 UTC, Atila Neves wrote:
> > If you add to all that "No, really, it's ok, there's this project that forked one of the compilers. No, it's not the reference compiler. There's just this bit of non-standard syntax to learn that's neither C nor D", then the chances of convincing any "normal" engineer are 0.
>
> It is the reference compiler though (which is the frontend), the backend is different, but they don't want the dmc backend do they? Also recently it started to use pragma and import syntax, which are both D.

Yes, the frontend is shared, but you don't just use the frontend. You use the whole compiler. dmd is the reference compiler and what your average programmer coming to D is going to expect to be using (at least initially). And telling folks that they have to use a language feature that is not supported by the reference compiler is not going to go over well with a lot of people. It would be one thing to tell them that they should use ldc, because it generates faster code. That doesn't involve forking the language. Your code would then still work just fine with dmd. It would just be slower. It's quite another thing to tell them to use a feature that dmd doesn't support. That _would_ be forking the language, and it would mean writing programs that would not work with the reference compiler. Many folks are not going to be happy with the idea of using a fork rather than the real deal. Some folks will probably be fine with it, but in general, it just plain looks bad.

It's one thing for someone who is familiar with D to weigh the options and decide that being tied to ldc is okay. It's quite another to tell someone who isn't familiar with D that in order to use D, they have to use a feature which only works with a specific compiler that is not the reference compiler and which will likely never work with the reference compiler.

- Jonathan M Davis

April 11, 2018
On Wednesday, 11 April 2018 at 06:12:49 UTC, rikki cattermole wrote:
> On 09/04/2018 11:03 PM, Atila Neves wrote:
>> Here's my blog post about my project that allows directly #including C headers in D*
>> 
>> https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/
>> 
>> 
>> The summary is that, modulo bugs, things like this work:
>> 
>>      #include <stdio.h>
>>      void main() { printf("Hello world\n".ptr); }
>> 
>> So far it's successfully compiled whilst #including pthread, libcurl, openssl and others. The blog and the github README have more information, and feel free to reply to this with questions.
>> 
>> dub: http://code.dlang.org/packages/dpp
>> reddit: https://www.reddit.com/r/programming/comments/8axj53/include_c_headers_in_d_code/
>> 
>> hacker news: It's in there somewhere, search around.
>> 
>> Atila
>> 
>> * Technically, "D + #include directives + C macros"
>
> Any chance objectice-c as well?

I don't know Objective-C. The only way I can think of to even get close to getting it to work is by copying the relevant tests from dstep. I also don't think the language is nearly as important as C and C++ in terms of fostering D adoption.

So probably no unless someone sends PRs my way.

April 11, 2018
On Wednesday, 11 April 2018 at 06:21:47 UTC, Jacob Carlborg wrote:
> On Tuesday, 10 April 2018 at 23:44:46 UTC, Atila Neves wrote:
>
>> The beauty of using libclang is that name mangling issues don't exist. :)
>
> How is that not going to be an issue? Are you adding `pragma(mangle)` everywhere?

Yes.

I don't know how to deal with class templates yet though, since none of their member functions have mangled symbols until they're instantiated. Which obviously doesn't happen at the declaration.