www.digitalmars.com         C & C++   DMDScript  

digitalmars.dip.ideas - For the ImportC feature, one must use the keyword "importC" instead of

reply =?UTF-8?B?0JjQu9GM0Y8=?= <my-ijet mail.ru> writes:
"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. Why not make the different behaviors explicit?
Mar 24
parent reply IchorDev <zxinsworld gmail.com> writes:
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.
Mar 30
parent reply Hipreme <msnmancini hotmail.com> writes:
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.
Apr 02
parent Walter Bright <newshound2 digitalmars.com> writes:
On 4/2/2024 10:17 AM, Hipreme wrote:
 But I do agree that importing C files the same way as D it is quite bizarre.
The purpose of the design is so that the importer need not know how the module is implemented.
Apr 03