ImportC shows the way to D3?

claptrap clap at trap.com
Mon Jun 20 23:13:17 UTC 2022


On Monday, 20 June 2022 at 08:19:36 UTC, bauss wrote:
> On Monday, 20 June 2022 at 08:05:38 UTC, claptrap wrote:
>> So if D can "import" C code then could the same mechanism be 
>> used to move to D3? Have the compiler compile D2 and D3 code 
>> to the same AST?
>>
>> Disclaimer : I dont know exactly how ImportC works but it 
>> sounds like it compiles C code into the same AST that D code 
>> uses. Then its all compiled the same.
>>
>> yeah I know D3... but it could be a way to introduce breaking 
>> changes without too much pain?
>>
>> Surely i cant be the only person who's thought of this?
>
> The only problem I see is how will you differentiate a module 
> from D2 with a module from D3?
>
> At least how would you do that without having to specify that 
> for each source file that it belongs to either D2 or D3, 
> because I can't really seeing it being automated easily.

you'd have to manually differentiate, and do it in a way that 
existing code is unaffected, so mark D3 files with a different 
file extension, like .d3?


More information about the Digitalmars-d mailing list