DIP 1005 - Preliminary Review Round 1

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 22 09:13:20 PDT 2017


On 22.04.2017 13:54, Mike Parker wrote:
> DIP 1005 is titled "Dependency-Carrying Declarations".
>
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md
>
> All review-related feedback on and discussion of the DIP should occur in
> this thread. Due to DConf taking place during the review period, the
> period will be extended by a week. The review period will end at 11:59
> PM ET on May 13 (3:59 AM GMT on May 14), or when I make a post declaring
> it complete.
>
> At the end of Round 1, if further review is deemed necessary, the DIP
> will be scheduled for another round. Otherwise, because the DIP comes
> from a language author and no formal review period by the language
> authors is necessary, the DIP will be marked "Accepted" or "Rejected" at
> the author's discretion.
>
> An extensive discussion regarding this DIP has already taken place [1].
>
> Thanks in advance to all who participate.
>
> Destroy!
>
> [1] http://forum.dlang.org/thread/o2psvk$1m96$1@digitalmars.com?page=1


"* Inside any function, all uses of with are statements and obey the 
current language rules.

* Everywhere else, ..."


"* Inside any function, with (Import ImportList) is a statement that 
introduces a scope. Inside the with, lookup considers the import local 
to the declaration (similar to the current handling of nested imports).

* Everywhere else, ..."


Please don't do this.



"This extension removes an unforced limitation of the current with 
syntax (allows it to occur at top level)"

No, it does not. It introduces two more incompatible syntaxes that look 
the same, yet are different.



"The drawback of this choice is the potentially confusing handling of 
scopes: the with statement introduces a scope, whereas the with 
declaration does not."

It's not merely confusing, it's frustrating. I might legitimately want 
to use the new feature on a local declaration. As an analogy, just 
imagine how frustrating it would be if 'static if' was written as 'if' 
with different meaning depending on the scope.



Just associate actual syntax to the the scope handling. The proposal 
would be sane if it instead introduced a new 'static with' construct 
that actually has the same meaning in every context.

This is how it works for static if, and it is also how it will work for 
static foreach, so it is even consistent with other language features.



More information about the Digitalmars-d mailing list