Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d
On 5/21/18 4:29 PM, Yuxuan Shui wrote: My response below might be a little off-topic. On Monday, 21 May 2018 at 13:06:14 UTC, Steven Schveighoffer wrote: [snip] There is something to be said for keeping the compiler dumb: 1. Dumb is easy to implement, explain, and understand -- if you set th

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-21 Thread Yuxuan Shui via Digitalmars-d
I've been using Swift in the past few years quite a bit, and it always amuses me when it can't figure out some kind of inference that seems trivial, but it just gives up because the compiler takes too long to determine: "This [one line] statement is too difficult, please split into multiple st

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-21 Thread Yuxuan Shui via Digitalmars-d
My response below might be a little off-topic. On Monday, 21 May 2018 at 13:06:14 UTC, Steven Schveighoffer wrote: [snip] There is something to be said for keeping the compiler dumb: 1. Dumb is easy to implement, explain, and understand -- if you set the bar low then more compilers will be a

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d
On 5/20/18 6:56 AM, Yuxuan Shui wrote: On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: because it tends to become very difficult to get right in all cases and results in situations where the programmer is forced to do something in order to make the compiler shut up Well, doesn

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-20 Thread Yuxuan Shui via Digitalmars-d
On Sunday, 20 May 2018 at 14:39:28 UTC, Jonathan M Davis wrote: Well, constructors are one of the few places that the compiler attempts flow analysis for stuff other than optimization, because it pretty much has to in order to do what the language needs. And no, it's not very sophisticated abou

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-20 Thread Jonathan M Davis via Digitalmars-d
On Sunday, May 20, 2018 10:56:27 Yuxuan Shui via Digitalmars-d wrote: > On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: > > because it tends to become very difficult to get right in all > > cases and results in situations where the programmer is forced > > to do something in order t

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-20 Thread Daniel N via Digitalmars-d
On Sunday, 20 May 2018 at 10:56:27 UTC, Yuxuan Shui wrote: On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: because it tends to become very difficult to get right in all cases and results in situations where the programmer is forced to do something in order to make the compiler s

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-20 Thread Yuxuan Shui via Digitalmars-d
On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: because it tends to become very difficult to get right in all cases and results in situations where the programmer is forced to do something in order to make the compiler shut up Well, doesn't this post show exactly this problem,

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Sunday, 20 May 2018 at 03:13:12 UTC, Neia Neutuladh wrote: While it's mildly refreshing that you found something new to talk about, it would be nice if you found something productive to say. You're merely complaining that a person who has spent about two decades on D (for free), who has de

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 20 May 2018 at 02:53:10 UTC, KingJoffrey wrote: On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: As I understand it, in general, Walter is against doing ... All I ever hear, is walter walter walter While it's mildly refreshing that you found something new to ta

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: As I understand it, in general, Walter is against doing ... All I ever hear, is walter walter walter mmm..takes me back to my childhood.. https://www.youtube.com/watch?v=-yZHveWFvqM

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread Jonathan M Davis via Digitalmars-d
On Saturday, May 19, 2018 22:54:16 Yuxuan Shui via Digitalmars-d wrote: > On Thursday, 17 May 2018 at 20:32:23 UTC, Steven Schveighoffer > > wrote: > > On 5/17/18 4:25 PM, DarkHole wrote: > >> On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer > >> > >> wrote: > >>> On 5/17/18 3:55 PM,

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 17 May 2018 at 20:32:23 UTC, Steven Schveighoffer wrote: On 5/17/18 4:25 PM, DarkHole wrote: On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer wrote: On 5/17/18 3:55 PM, DarkHole wrote: This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: cons

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-17 Thread Steven Schveighoffer via Digitalmars-d
On 5/17/18 4:25 PM, DarkHole wrote: On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer wrote: On 5/17/18 3:55 PM, DarkHole wrote: This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: constructor calls not allowed in loops or after labels", but there is no l

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-17 Thread DarkHole via Digitalmars-d
On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer wrote: On 5/17/18 3:55 PM, DarkHole wrote: This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: constructor calls not allowed in loops or after labels", but there is no loops or labels. Switch cases are la

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-17 Thread Steven Schveighoffer via Digitalmars-d
On 5/17/18 4:02 PM, Steven Schveighoffer wrote: On 5/17/18 3:55 PM, DarkHole wrote: This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: constructor calls not allowed in loops or after labels", but there is no loops or labels. Switch cases are labels. That being sai

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-17 Thread Steven Schveighoffer via Digitalmars-d
On 5/17/18 3:55 PM, DarkHole wrote: This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: constructor calls not allowed in loops or after labels", but there is no loops or labels. Switch cases are labels. -Steve

Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-17 Thread DarkHole via Digitalmars-d
This strange code - https://run.dlang.io/is/BKgv49 - fails with error "Error: constructor calls not allowed in loops or after labels", but there is no loops or labels.