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

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 21 15:40:23 PST 2016


On Mon, Dec 19, 2016 at 9:33 PM, Timothee Cour <thelastmammoth at gmail.com>
wrote:

> what about using `lazy` instead of `with`:
>
> `with(import foo)`
> =>
> `lazy(import foo)`
>
> advantages:
> * avoids confusion regarding usual scoping rules of `with` ;
> * conveys that the import is indeed lazy
>
> Furthermore (regardless of which keyword is used), what about allowing `:`
> ```
> // case 1
> lazy(import foo)
> void fun(){}
>
> // case 2
> lazy(import foo) {
>   void fun(){}
> }
>
> // case 3 : this is new
> lazy(import foo):
> void fun1(){}
> void fun2(){}
> ```
>
> advantages:
>
> * same behavior as other constructs which don't introduce a scope:
> ```
> // case 1, 2 3 are allowed:
> version(A):
> static if(true):
> private:
> void fun(){}
> ```
>
> * avoids nesting when case 3 is used (compared to when using `{}`)
>
> * I would argue that grouping lazy imports is actually a common case;
> without case 3, the indentation will increase.
>


Andrei: ping on this? (especially regarding allowing `:`)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20161221/fe08c71c/attachment.html>


More information about the Digitalmars-d mailing list