Re: Static foreach bug?

2018-09-07 Thread Dechcaudron via Digitalmars-d
On Thursday, 6 September 2018 at 15:56:50 UTC, Jonathan M Davis wrote: However, since attributes are applied to functions, and __gshared is for variables, it really wouldn't make sense to have @gshared, and by that same token, it wouldn't make sense to have @ctlocal. I don't see any reason

Re: Static foreach bug?

2018-09-06 Thread Jonathan M Davis via Digitalmars-d
On Thursday, September 6, 2018 3:11:14 AM MDT Dechcaudron via Digitalmars-d wrote: > On Wednesday, 5 September 2018 at 11:39:31 UTC, Jonathan M Davis > > wrote: > > Conceptually, what Timon is talking about doing here is to add > > an attribute to symbols declared within a static foreach where >

Re: Static foreach bug?

2018-09-06 Thread Dechcaudron via Digitalmars-d
On Wednesday, 5 September 2018 at 11:39:31 UTC, Jonathan M Davis wrote: Conceptually, what Timon is talking about doing here is to add an attribute to symbols declared within a static foreach where that attribute indicates that the symbol is temporary (or at least scoped to a particular

Re: Static foreach bug?

2018-09-05 Thread Timon Gehr via Digitalmars-d
On 05.09.2018 12:29, Dechcaudron wrote: On Tuesday, 4 September 2018 at 19:50:27 UTC, Timon Gehr wrote: The only blocker is finding a good syntax. How does "static enum" sound? It can't be anything that is legal code today (__local works for all declarations, not just enums).

Re: Static foreach bug?

2018-09-05 Thread Timon Gehr via Digitalmars-d
On 05.09.2018 14:41, Andre Pany wrote: On Wednesday, 5 September 2018 at 12:05:59 UTC, rikki cattermole wrote: Indeed. scope enum would make much more sense. scope enum sounds a lot better for me than static enum or even __local. The __ words looks a little bit like compiler magic as the __

Re: Static foreach bug?

2018-09-05 Thread rikki cattermole via Digitalmars-d
On 06/09/2018 12:52 AM, JN wrote: On Wednesday, 5 September 2018 at 12:41:05 UTC, Andre Pany wrote: On Wednesday, 5 September 2018 at 12:05:59 UTC, rikki cattermole wrote: Indeed. scope enum would make much more sense. scope enum sounds a lot better for me than static enum or even __local.

Re: Static foreach bug?

2018-09-05 Thread JN via Digitalmars-d
On Wednesday, 5 September 2018 at 12:41:05 UTC, Andre Pany wrote: On Wednesday, 5 September 2018 at 12:05:59 UTC, rikki cattermole wrote: Indeed. scope enum would make much more sense. scope enum sounds a lot better for me than static enum or even __local. The __ words looks a little bit

Re: Static foreach bug?

2018-09-05 Thread Andre Pany via Digitalmars-d
On Wednesday, 5 September 2018 at 12:05:59 UTC, rikki cattermole wrote: Indeed. scope enum would make much more sense. scope enum sounds a lot better for me than static enum or even __local. The __ words looks a little bit like compiler magic as the __ words are reserved for the compiler.

Re: Static foreach bug?

2018-09-05 Thread rikki cattermole via Digitalmars-d
On 05/09/2018 11:39 PM, Jonathan M Davis wrote: On Wednesday, September 5, 2018 5:19:04 AM MDT Dechcaudron via Digitalmars-d wrote: On Wednesday, 5 September 2018 at 10:45:20 UTC, Jonathan M Davis wrote: Too many people already think that the point of static is to just make something be done

Re: Static foreach bug?

2018-09-05 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, September 5, 2018 5:19:04 AM MDT Dechcaudron via Digitalmars-d wrote: > On Wednesday, 5 September 2018 at 10:45:20 UTC, Jonathan M Davis > > wrote: > > Too many people already think that the point of static is to > > just make something be done at compile time (which is actually > >

Re: Static foreach bug?

2018-09-05 Thread Dechcaudron via Digitalmars-d
On Wednesday, 5 September 2018 at 10:45:20 UTC, Jonathan M Davis wrote: Too many people already think that the point of static is to just make something be done at compile time (which is actually a pretty terrible reason to use static) without adding that sort of thing into the confusion.

Re: Static foreach bug?

2018-09-05 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, September 5, 2018 4:29:32 AM MDT Dechcaudron via Digitalmars-d wrote: > On Tuesday, 4 September 2018 at 19:50:27 UTC, Timon Gehr wrote: > > The only blocker is finding a good syntax. > > How does "static enum" sound? Like it would be really, really confusing. Too many people

Re: Static foreach bug?

2018-09-05 Thread Dechcaudron via Digitalmars-d
On Tuesday, 4 September 2018 at 19:50:27 UTC, Timon Gehr wrote: The only blocker is finding a good syntax. How does "static enum" sound?

Re: Static foreach bug?

2018-09-04 Thread Timon Gehr via Digitalmars-d
On 02.09.2018 15:45, bauss wrote: On Sunday, 2 September 2018 at 13:26:55 UTC, Petar Kirov [ZombineDev] wrote: It's intended, but with the possibility to add special syntax for local declarations in the future left open, as per:

Re: Static foreach bug?

2018-09-03 Thread Meta via Digitalmars-d
On Monday, 3 September 2018 at 18:03:18 UTC, Soma wrote: Sorry to disrupt your threat, but as a lurking in this forum using D for small projects, and after looking such snippet my first impression is how D is getting polluted and becoming more like Java and C++. "final class", "public final

Re: Static foreach bug?

2018-09-03 Thread Soma via Digitalmars-d
On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: unmaintainable piece of code: ``` final class ClassName : SoapBinding, Interface { public: final: this() { super(); } import __stdtraits = std.traits; static foreach (member; __traits(derivedMembers, Interface)) {

Re: Static foreach bug?

2018-09-03 Thread Jonathan M Davis via Digitalmars-d
n Monday, September 3, 2018 12:39:17 AM MDT Neia Neutuladh via Digitalmars-d wrote: > On Monday, 3 September 2018 at 04:43:30 UTC, bauss wrote: > > On Sunday, 2 September 2018 at 20:01:08 UTC, Neia Neutuladh > > > > wrote: > >> On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: > >>> Woud

Re: Static foreach bug?

2018-09-03 Thread bauss via Digitalmars-d
On Monday, 3 September 2018 at 06:39:17 UTC, Neia Neutuladh wrote: On Monday, 3 September 2018 at 04:43:30 UTC, bauss wrote: On Sunday, 2 September 2018 at 20:01:08 UTC, Neia Neutuladh wrote: On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could

Re: Static foreach bug?

2018-09-03 Thread Neia Neutuladh via Digitalmars-d
On Monday, 3 September 2018 at 04:43:30 UTC, bauss wrote: On Sunday, 2 September 2018 at 20:01:08 UTC, Neia Neutuladh wrote: On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could have each statement into a variable that could be maintained

Re: Static foreach bug?

2018-09-02 Thread bauss via Digitalmars-d
On Sunday, 2 September 2018 at 20:01:08 UTC, Neia Neutuladh wrote: On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could have each statement into a variable that could be maintained properly. You could extract the body of the static foreach

Re: Static foreach bug?

2018-09-02 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could have each statement into a variable that could be maintained properly. You could extract the body of the static foreach into a [template] function.

Re: Static foreach bug?

2018-09-02 Thread bauss via Digitalmars-d
On Sunday, 2 September 2018 at 18:07:10 UTC, Jonathan M Davis wrote: On Sunday, September 2, 2018 7:21:05 AM MDT bauss via Digitalmars-d wrote: Is there a reason why you cannot create a separate scope within a static foreach? The below will not compile: ``` enum a = ["a" : "a", "b" : "b",

Re: Static foreach bug?

2018-09-02 Thread Jonathan M Davis via Digitalmars-d
On Sunday, September 2, 2018 7:21:05 AM MDT bauss via Digitalmars-d wrote: > Is there a reason why you cannot create a separate scope within a > static foreach? > > The below will not compile: > > ``` > enum a = ["a" : "a", "b" : "b", "c" : "c"]; > > static foreach (k,v; a) > { > { >

Re: Static foreach bug?

2018-09-02 Thread Basile B. via Digitalmars-d
On Sunday, 2 September 2018 at 13:21:05 UTC, bauss wrote: Is there a reason why you cannot create a separate scope within a static foreach? The below will not compile: ``` enum a = ["a" : "a", "b" : "b", "c" : "c"]; static foreach (k,v; a) { { enum b = k; enum c = v;

Re: Static foreach bug?

2018-09-02 Thread bauss via Digitalmars-d
On Sunday, 2 September 2018 at 13:26:55 UTC, Petar Kirov [ZombineDev] wrote: It's intended, but with the possibility to add special syntax for local declarations in the future left open, as per: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1010.md#local-declarations Is there any

Re: Static foreach bug?

2018-09-02 Thread Petar via Digitalmars-d
On Sunday, 2 September 2018 at 13:21:05 UTC, bauss wrote: Is there a reason why you cannot create a separate scope within a static foreach? The below will not compile: ``` enum a = ["a" : "a", "b" : "b", "c" : "c"]; static foreach (k,v; a) { { enum b = k; enum c = v;

Re: Static foreach bug?

2018-09-02 Thread bauss via Digitalmars-d
On Sunday, 2 September 2018 at 13:21:05 UTC, bauss wrote: Is there a reason why you cannot create a separate scope within a static foreach? You can try it out here: https://run.dlang.io/is/7DgwCk