DIP10005: Dependency-Carrying Declarations is now available for community feedback

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 14 13:21:39 PST 2016


On Wednesday, 14 December 2016 at 17:28:57 UTC, Andrei 
Alexandrescu wrote:
> On 12/14/2016 12:07 PM, David Gileadi wrote:
>> The above rule doesn't cover non-template function 
>> declarations like the
>> `process` example in the DIP, however. Are they an important 
>> enough use
>> case to justify new syntax?
>
> I suspect 90% of all uses will be straight definitions of 
> template functions or template structs/classes. So by that 
> estimate we should be in good shape.
>
> However, looking inside the definition in order to look up 
> names in its declarations breaks the rule of least 
> astonishment. Making the import part of the syntactical unit of 
> the declaration seems to be the path of least resistance.

It also doesn't work with function prototypes. With the proposed 
syntax, you can do

     int foo(SysTime st) import(std.datetime);

but if the compiler has to look into the function body to get at 
the import, then a prototype like this would be out of luck.

- Jonathan M Davis


More information about the Digitalmars-d mailing list