For the ImportC feature, one must use the keyword "importC" instead of "import"

Hipreme msnmancini at hotmail.com
Tue Apr 2 17:17:21 UTC 2024


On Saturday, 30 March 2024 at 14:28:23 UTC, IchorDev wrote:
> On Sunday, 24 March 2024 at 08:48:43 UTC, Илья wrote:
>> "import" imports both .c files and .d files while they can be 
>> named the same.This is a problem.
>> In addition, during the import .c files compiler acts a little 
>> differently.
>
> I think `import(C)` would be a good syntax, because we already 
> have this syntax for `extern`. As to the importance of this 
> feature, it's hard for me to say.

The syntax with parenthesis is used for loading any kind of file 
with string import paths.
That being said, I don't think it is possible to do that on the 
compiler side. But I do agree that importing C files the same way 
as D it is quite bizarre.

I know that they used to have a syntax validation for `#include`. 
Maybe they could use it for something like `#import`, just like 
Objective-C does.


More information about the dip.ideas mailing list