Embrace the from template?

Basile B. b2.temp at gmx.com
Sat Aug 25 10:13:05 UTC 2018


On Friday, 24 August 2018 at 10:58:29 UTC, aliak wrote:
> On Friday, 24 August 2018 at 06:41:35 UTC, Jonathan Marler 
> wrote:
>> Ever since I read 
>> https://dlang.org/blog/2017/02/13/a-new-import-idiom/ I've 
>> very much enjoyed using the new `from` template. [...]
>> Of course, if we don't want to encourage use of the `from` 
>> template then this is not what we'd want.  Does anyone have 
>> any data/experience with from?  All I know is my own usage so 
>> feel free to chime in with yours.
>
> One of the first things I do after a dub init is create a file 
> called internal.d with the from template in it. My only gripe 
> about this template is it's "autocompletion-able-ness" in IDEs 
> and if that can be handled.
>
> [...]

Assuming you use DCD, even if CTFE is not handled it would be 
possible to detect the signature and to do with "from" what's 
usually done with an import.
But it needs to be in a well defined module. You can open an 
issue in the repository asking for this and the feature will be 
added once the D-runtime PR merged.


More information about the Digitalmars-d mailing list