Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-12 Thread Quirin Schroll via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 06:41:04 UTC, zjh wrote: On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: .. Is it okay to use a new keyword `enumswitch` that is equivalent to `with final switch`? Why would you use a new keyword? Use `enum switch` with a space. Both are keywords

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread ryuukk_ via Digitalmars-d-announce
On Friday, 12 May 2023 at 03:11:49 UTC, ryuukk_ wrote: On Thursday, 11 May 2023 at 23:00:03 UTC, epilogue wrote: On Thursday, 11 May 2023 at 00:56:03 UTC, ryuukk_ wrote: Don't you find this code easier to read and review? ```D if (target.os == .Windows) {

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread ryuukk_ via Digitalmars-d-announce
On Thursday, 11 May 2023 at 23:00:03 UTC, epilogue wrote: On Thursday, 11 May 2023 at 00:56:03 UTC, ryuukk_ wrote: Don't you find this code easier to read and review? ```D if (target.os == .Windows) { item("windows"); } else {

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread epilogue via Digitalmars-d-announce
On Thursday, 11 May 2023 at 00:56:03 UTC, ryuukk_ wrote: Don't you find this code easier to read and review? ```D if (target.os == .Windows) { item("windows"); } else { item("posix"); if (target.os == .linux)

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread Steven Schveighoffer via Digitalmars-d-announce
On 5/11/23 10:10 AM, Paul Backus wrote: On Thursday, 11 May 2023 at 13:31:58 UTC, Steven Schveighoffer wrote: On 5/10/23 11:22 PM, Paul Backus wrote: In fact, for this particular example, there are actually two enums in the DMD source code that these symbols could be coming from: `enum

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 11 May 2023 at 13:31:58 UTC, Steven Schveighoffer wrote: On 5/10/23 11:22 PM, Paul Backus wrote: In fact, for this particular example, there are actually two enums in the DMD source code that these symbols could be coming from: `enum TargetOS` in `cli.d`, and `enum OS` in

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-11 Thread Steven Schveighoffer via Digitalmars-d-announce
On 5/10/23 11:22 PM, Paul Backus wrote: In fact, for this particular example, there are actually two enums in the DMD source code that these symbols could be coming from: `enum TargetOS` in `cli.d`, and `enum OS` in `target.d`. So you would have to scroll up and look at the imports to

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-10 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 11 May 2023 at 00:56:03 UTC, ryuukk_ wrote: Don't you find this code easier to read and review? ```D if (target.os == .Windows) { item("windows"); } else { item("posix"); if (target.os == .linux)

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-10 Thread ryuukk_ via Digitalmars-d-announce
I was reading DMD source code, case of repetition that adds nothing of value but useless reading strain https://github.com/dlang/dmd/blob/999d835c1196eb993a99bb7f1c863da265a6b6c0/compiler/src/dmd/json.d#L843-L869 ```D if (target.os == Target.OS.Windows) {

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-01 Thread ryuukk_ via Digitalmars-d-announce
On Monday, 1 May 2023 at 14:03:51 UTC, bachmeier wrote: On Monday, 1 May 2023 at 00:34:03 UTC, ryuukk_ wrote: I don't think it's a misconception. It's more like a complete lack of clarity. the goal is not to use an anonymous enum, the goal is to leverage the robust type system to avoid

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-01 Thread Max Samukha via Digitalmars-d-announce
On Monday, 1 May 2023 at 14:03:51 UTC, bachmeier wrote: ``` value.type = STRING; ``` IRL people would use namespacing prefixes or actual namespaces anyway, so your example would look more like ``` value.type = VALUE_TYPE_STRING; ```

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-05-01 Thread bachmeier via Digitalmars-d-announce
On Monday, 1 May 2023 at 00:34:03 UTC, ryuukk_ wrote: I don't think it's a misconception. It's more like a complete lack of clarity. the goal is not to use an anonymous enum, the goal is to leverage the robust type system to avoid repeting yourself, wich is bad ``` Value value; value.type

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-30 Thread ryuukk_ via Digitalmars-d-announce
Do you write this? ``` float myfloat = float(1.0); ``` Or this? ``` float myfloat = 1.0; ``` Why would it be different for enums (or any other type) Also i suggest you to try all kind of languages to expand your knowledge and to try out new UX that modern languages provide, there is no

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-30 Thread ryuukk_ via Digitalmars-d-announce
On Thursday, 27 April 2023 at 13:03:17 UTC, bachmeier wrote: On Thursday, 27 April 2023 at 06:10:57 UTC, Basile B. wrote: On Thursday, 27 April 2023 at 00:16:10 UTC, Walter Bright wrote: This also works: alias F = MySuperLongNameFlag; auto flag = F.A | F.B | F.C | F.D;

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-27 Thread bachmeier via Digitalmars-d-announce
On Thursday, 27 April 2023 at 06:10:57 UTC, Basile B. wrote: It's a misconception of the problem that the DIP tried to solve. What the DIP tried to solve is that the compiler should know that you are using an enum member. Actually I even think this should work without any special syntax, as a

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-27 Thread bachmeier via Digitalmars-d-announce
On Thursday, 27 April 2023 at 06:10:57 UTC, Basile B. wrote: On Thursday, 27 April 2023 at 00:16:10 UTC, Walter Bright wrote: This also works: alias F = MySuperLongNameFlag; auto flag = F.A | F.B | F.C | F.D; set_flags(F.A | F.B | F.C | F.D); It's similar to setting a local

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-27 Thread Basile B. via Digitalmars-d-announce
On Thursday, 27 April 2023 at 00:16:10 UTC, Walter Bright wrote: This also works: alias F = MySuperLongNameFlag; auto flag = F.A | F.B | F.C | F.D; set_flags(F.A | F.B | F.C | F.D); It's similar to setting a local variable to some complex expression, just so you don't have to

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Walter Bright via Digitalmars-d-announce
This also works: alias F = MySuperLongNameFlag; auto flag = F.A | F.B | F.C | F.D; set_flags(F.A | F.B | F.C | F.D); It's similar to setting a local variable to some complex expression, just so you don't have to repeat that expression multiple times.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Jacob Shtokolov via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 14:54:40 UTC, max haughton wrote: https://github.com/dlang/dmd/pull/13776 Wow, didn't know about this PR exists. Thank you for sharing!

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Walter Bright via Digitalmars-d-announce
On 4/26/2023 1:19 AM, Stefan Koch wrote: While it is true that it only implements a subset of the proposal. It does implemnent function overloading for non-templated functions the specific code for this is here:

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 15:07:36 UTC, ryuukk_ wrote: Again, all of this was covered and argumented during the DIP discussion The goal is to improve the language, not find excuses or workarounds, don't defend obfuscation, move forward Your proposals were built on unrealistic examples

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 13:08:22 UTC, Jacob Shtokolov wrote: On Wednesday, 26 April 2023 at 12:50:32 UTC, bachmeier wrote: Many other solutions were provided as well, including but not limited to - Using shorter names - Using alias - Using an IDE with autocomplete - Using copy and

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread ryuukk_ via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 12:50:32 UTC, bachmeier wrote: On Wednesday, 26 April 2023 at 11:52:31 UTC, Jacob Shtokolov wrote: On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: void set_connected() { network_connect_state = NetworkConnectState.CONNECTED } MySuperLongNameFlag

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread ryuukk_ via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 10:48:21 UTC, Greggor wrote: On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread ryuukk_ via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 11:52:31 UTC, Jacob Shtokolov wrote: On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: void set_connected() { network_connect_state = NetworkConnectState.CONNECTED } MySuperLongNameFlag flag = MySuperLongNameFlag.A | MySuperLongNameFlag.B |

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread max haughton via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 13:08:22 UTC, Jacob Shtokolov wrote: On Wednesday, 26 April 2023 at 12:50:32 UTC, bachmeier wrote: Many other solutions were provided as well, including but not limited to - Using shorter names - Using alias - Using an IDE with autocomplete - Using copy and

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Basile B. via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. [...] While I was rather "pro" I think that D lacked

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Jacob Shtokolov via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 12:50:32 UTC, bachmeier wrote: Many other solutions were provided as well, including but not limited to - Using shorter names - Using alias - Using an IDE with autocomplete - Using copy and paste While aliases and shorter names are always good options,

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread bachmeier via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. This was the right decision, but it would have been

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 11:52:31 UTC, Jacob Shtokolov wrote: On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: void set_connected() { network_connect_state = NetworkConnectState.CONNECTED } MySuperLongNameFlag flag = MySuperLongNameFlag.A | MySuperLongNameFlag.B |

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Jacob Shtokolov via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: void set_connected() { network_connect_state = NetworkConnectState.CONNECTED } MySuperLongNameFlag flag = MySuperLongNameFlag.A | MySuperLongNameFlag.B | MySuperLongNameFlag.C | MySuperLongNameFlag.D;

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Greggor via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. [...] I’m going to contribute to the peanut gallery,

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Ogi via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 01:39:14 UTC, Walter Bright wrote: That only does a subset of the proposal. The inference only works in specific cases. Things like function overloading are not addressed. Should we remove struct initializers as well? ```D struct S { int x; } void fun(S) {}

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 01:39:14 UTC, Walter Bright wrote: On 4/25/2023 1:15 PM, ryuukk_ wrote: Or perhaps, listen to this person: https://github.com/dlang/dmd/pull/14650 That only does a subset of the proposal. The inference only works in specific cases. Things like function

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread ryuukk_ via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 01:39:14 UTC, Walter Bright wrote: On 4/25/2023 1:15 PM, ryuukk_ wrote: Or perhaps, listen to this person: https://github.com/dlang/dmd/pull/14650 That only does a subset of the proposal. The inference only works in specific cases. Things like function

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread max haughton via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 01:26:03 UTC, Walter Bright wrote: On 4/25/2023 4:12 PM, max haughton wrote: I have never been in favour of D having bitfields. This isn't worth breaking stuff for. D bitfields didn't break anything. Also, it exposed an overlooked bug in the ImportC bitfields.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread Walter Bright via Digitalmars-d-announce
On 4/25/2023 1:15 PM, ryuukk_ wrote: Or perhaps, listen to this person: https://github.com/dlang/dmd/pull/14650 That only does a subset of the proposal. The inference only works in specific cases. Things like function overloading are not addressed.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread Walter Bright via Digitalmars-d-announce
On 4/25/2023 4:12 PM, max haughton wrote: I have never been in favour of D having bitfields. This isn't worth breaking stuff for. D bitfields didn't break anything. Also, it exposed an overlooked bug in the ImportC bitfields.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread max haughton via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 22:39:35 UTC, ryuukk_ wrote: On Tuesday, 25 April 2023 at 20:59:23 UTC, max haughton wrote: On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: On Tuesday, 25 April 2023 at 18:38:14 UTC, max haughton wrote: [...] Why you guys focus on "switch" Because

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread ryuukk_ via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 20:59:23 UTC, max haughton wrote: On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: On Tuesday, 25 April 2023 at 18:38:14 UTC, max haughton wrote: [...] Why you guys focus on "switch" Because that's the example given by Mike... Who doesn't love writing

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread max haughton via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 20:15:39 UTC, ryuukk_ wrote: On Tuesday, 25 April 2023 at 18:38:14 UTC, max haughton wrote: [...] Why you guys focus on "switch" Because that's the example given by Mike... Who doesn't love writing other than Walter Bright: [...] Who are you saying said it's

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread ryuukk_ via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 18:38:14 UTC, max haughton wrote: On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: Firstly I think this is the correct decision, certainly for now, probably forever. Regarding enums in switch statements, Walter suggested we could shorten the `with

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. [snip] I didn't follow this too closely last year,

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread max haughton via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: Firstly I think this is the correct decision, certainly for now, probably forever. Regarding enums in switch statements, Walter suggested we could shorten the `with final switch` syntax such that the `with` is implicitly applied

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. IMO this is the correct decision. While a feature like

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread WebFreak001 via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread Doigt via Digitalmars-d-announce
This is not good news :-|

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread Dukc via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. That DIP sure became a bikeshed at the last review.

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread zjh via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 06:41:04 UTC, zjh wrote: Is it okay to use a new keyword `enumswitch` that is equivalent to `with final switch`? If there were an `official restriction` that could simplify `long keywords`, that would be great,like: ```d alias keyword enumswitch=with final

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-25 Thread zjh via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: .. Is it okay to use a new keyword `enumswitch` that is equivalent to `with final switch`?

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-24 Thread ryuukk_ via Digitalmars-d-announce
On Tuesday, 25 April 2023 at 04:54:43 UTC, Mike Parker wrote: I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal.

DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-24 Thread Mike Parker via Digitalmars-d-announce
I submitted DIP1044, "Enum Type Inference", to Walter and Atila on April 1. I received the final decision from them on April 18. They have decided not to accept this proposal. https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1044.md The said the proposal was well done and an