November 15, 2021
On Monday, 15 November 2021 at 17:48:35 UTC, H. S. Teoh wrote:
[...]
> Why can't you just write:
>
> 	MyAbility ability;
>
> 	switch (ability) with(MyAbility)
> 	{
> 	 case SOMETHING_1: break;
> 	 case SOMETHING_2: break;
> 	 case SOMETHING_3: break;
> 	 case SOMETHING_4: break;
> 	 case SOMETHING_5: break;
> 	}
>
> ?  The `with` keyword was designed specifically for this purpose.

Nice. What about

   import std.stdio;
   enum SAB {
      a = 1,
   }
   void main ()
   {
      with (SAB) if (a == 1) writeln ("true");
      with (SAB) void foo () { writeln (a); } // no complaints!
      foo(); // Error: undefined identifier `foo`
   }


November 15, 2021
On Mon, Nov 15, 2021 at 09:10:51PM +0000, kdevel via Digitalmars-d wrote:
> On Monday, 15 November 2021 at 17:48:35 UTC, H. S. Teoh wrote: [...]
> > Why can't you just write:
> > 
> > 	MyAbility ability;
> > 
> > 	switch (ability) with(MyAbility)
> > 	{
> > 	 case SOMETHING_1: break;
> > 	 case SOMETHING_2: break;
> > 	 case SOMETHING_3: break;
> > 	 case SOMETHING_4: break;
> > 	 case SOMETHING_5: break;
> > 	}
> > 
> > ?  The `with` keyword was designed specifically for this purpose.
> 
> Nice. What about
> 
>    import std.stdio;
>    enum SAB {
>       a = 1,
>    }
>    void main ()
>    {
>       with (SAB) if (a == 1) writeln ("true");
>       with (SAB) void foo () { writeln (a); } // no complaints!
>       foo(); // Error: undefined identifier `foo`
>    }
[...]

That's because `with` introduces a scope.  So you should have written instead:

	void foo () { with (SAB) writeln (a); }

Or, for that matter:

	void main ()
	{
	   with (SAB) {
	   	if (a == 1) writeln ("true");
	   	void foo () { writeln (a); }
	   	foo(); // Now this works
	   }
	}


T

-- 
Being able to learn is a great learning; being able to unlearn is a greater learning.
November 15, 2021
On Monday, 15 November 2021 at 21:23:56 UTC, H. S. Teoh wrote:
> On Mon, Nov 15, 2021 at 09:10:51PM +0000, kdevel via Digitalmars-d wrote:
>> On Monday, 15 November 2021 at 17:48:35 UTC, H. S. Teoh wrote: [...]
>> > Why can't you just write:
>> > 
>> > 	MyAbility ability;
>> > 
>> > 	switch (ability) with(MyAbility)
>> > 	{
>> > 	 case SOMETHING_1: break;
>> > 	 case SOMETHING_2: break;
>> > 	 case SOMETHING_3: break;
>> > 	 case SOMETHING_4: break;
>> > 	 case SOMETHING_5: break;
>> > 	}
>> > 
>> > ?  The `with` keyword was designed specifically for this purpose.
>> 
>> Nice. What about
>> 
>>    import std.stdio;
>>    enum SAB {
>>       a = 1,
>>    }
>>    void main ()
>>    {
>>       with (SAB) if (a == 1) writeln ("true");
>>       with (SAB) void foo () { writeln (a); } // no complaints!
>>       foo(); // Error: undefined identifier `foo`
>>    }
> [...]
>
> That's because `with` introduces a scope.  So you should have written instead:
>
> 	void foo () { with (SAB) writeln (a); }
>
> Or, for that matter:
>
> 	void main ()
> 	{
> 	   with (SAB) {
> 	   	if (a == 1) writeln ("true");
> 	   	void foo () { writeln (a); }
> 	   	foo(); // Now this works
> 	   }
> 	}
>
>
> T

that's not what i am asking

- now you leak SAB scope everywhere
- now you have to indent everything
- there is no differenciation between SAB.a and a variable called a


Why make things complicated and bloated when it can be simple?


Also why making me want to want something that is not what i asked? it's quite the opposite!
November 16, 2021
On 15.11.21 09:01, Arjan wrote:
> 
>> I started this:
>> https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md
>> https://github.com/tgehr/dmd/commits/tuple-syntax
>>
>> Unfortunately, I was too busy at the time to finish the implementation, and I am not fully satisfied with the proposal. Probably I'd want to add at least static opIndex and static opSlice to it. Another issue is that it slightly expands `alias this` and I am not sure whether that's a direction Walter is willing to invest in at this point.
> 
> Just WOW.
> 
> What would be needed to get you working on this again?

Some reassurance that it won't be shot down for stupid reasons would go a long way. For `static foreach`, the desired semantics were clear to Walter and Andrei from the start and they really wanted that feature in DMD, so that the DIP process went pretty smoothly. I am not feeling any similar excitement for tuples, even though it's the most wanted feature among forum readers according to the state of D 2018 survey... I just don't have the time and energy required for week-long forum debates anymore.
November 16, 2021
On 15.11.21 19:04, Q. Schroll wrote:
> On Tuesday, 12 October 2021 at 21:50:11 UTC, surlymoor wrote:
>> On Tuesday, 12 October 2021 at 21:38:48 UTC, Timon Gehr wrote:
>>> - .init
>>
>> Is the issue default initialization or that the property is named `init`?
> 
> The fact that the default value of a type `T` is `T.init` and `init` isn't even a keyword leading to all the problems it has, when it could have been `default(T)` is really embarrassing.

That's not close to all the problems and at least you can `@disable enum init = 0;` now.
November 17, 2021
On Tuesday, 16 November 2021 at 02:14:22 UTC, Timon Gehr wrote:
> On 15.11.21 09:01, Arjan wrote:
>> 
>>> I started this:
>>> https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md
>>> https://github.com/tgehr/dmd/commits/tuple-syntax
>>>
>>> Unfortunately, I was too busy at the time to finish the implementation, and I am not fully satisfied with the proposal. Probably I'd want to add at least static opIndex and static opSlice to it. Another issue is that it slightly expands `alias this` and I am not sure whether that's a direction Walter is willing to invest in at this point.
>> 
>> Just WOW.
>> 
>> What would be needed to get you working on this again?
>
> Some reassurance that it won't be shot down for stupid reasons would go a long way. For `static foreach`, the desired semantics were clear to Walter and Andrei from the start and they really wanted that feature in DMD, so that the DIP process went pretty smoothly. I am not feeling any similar excitement for tuples, even though it's the most wanted feature among forum readers according to the state of D 2018 survey... I just don't have the time and energy required for week-long forum debates anymore.

The proposition at that time was stalled because it collided with the comma expression and it was convened that the comma operator would have to be removed before tuple syntax could be introduced. Now that comma operator is deprecated, it would be the right time to reintroduce the tuple syntax.
November 17, 2021
On Monday, 15 November 2021 at 17:48:35 UTC, H. S. Teoh wrote:
> On Mon, Nov 15, 2021 at 05:25:35PM +0000, russhy via Digitalmars-d wrote: [...]
>> ```D
>> MyAbility ability;
>> 
>> switch (ability)
>> {
>>  case MyAbility.SOMETHING_1: break;
>>  case MyAbility.SOMETHING_2: break;
>>  case MyAbility.SOMETHING_3: break;
>>  case MyAbility.SOMETHING_4: break;
>>  case MyAbility.SOMETHING_5: break;
>> }
>> ```
>> 
>> 
>> What this repetition solves?
> [...]
>
> Why can't you just write:
>
> 	MyAbility ability;
>
> 	switch (ability) with(MyAbility)
> 	{
> 	 case SOMETHING_1: break;
> 	 case SOMETHING_2: break;
> 	 case SOMETHING_3: break;
> 	 case SOMETHING_4: break;
> 	 case SOMETHING_5: break;
> 	}
>
> ?  The `with` keyword was designed specifically for this purpose.
>
>
> T

I don't understand your point, that is exactly what i said, a nice use of with

There is a problem here, you don't listen to what i say, therefore you don't understand the problem

what about ALL OTHER problems? ;)

MyAbility ability switch ability with MyAbility use Ability

maybe we should have a @with instead of with, that'll solve the problem? /s
November 23, 2021
On 12.10.21 23:38, Timon Gehr wrote:
>> * Features you'd like to see in D

Another thing I have sometimes wished for, but forgot to include:

- package and module templates
November 23, 2021
On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:
> On 12.10.21 23:38, Timon Gehr wrote:
>>> * Features you'd like to see in D
>
> Another thing I have sometimes wished for, but forgot to include:
>
> - package and module templates

What do you mean by that?

Something like this? Or?

```d
module main;

import a!5;

void main()
{
	auto foo = new Foo;
	foo.field4 = 10;
}
```

```d
module a(int fieldCount);

import std.string : format;

class Foo
{
	static foreach (i; 0 .. fieldCount)
	{
		mixin(format("int field%d", i));
	}
}
```
November 23, 2021

On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:

>

On 12.10.21 23:38, Timon Gehr wrote:

> >
  • Features you'd like to see in D

Another thing I have sometimes wished for, but forgot to include:

  • package and module templates

You mean showing the static this() to accept parameters? That'd be amazing 😄