Re: Error: variable foo conflicts with struct foo

2018-01-04 Thread Stijn via Digitalmars-d-learn
On Thursday, 4 January 2018 at 17:59:55 UTC, Colin wrote: How can the compiler know which symbol is which symbol if everything has the same name? Standard practice is to capitalise type names and camelCase variable names. The C# compiler has no trouble understanding code like that, so I w

Re: Error: variable foo conflicts with struct foo

2018-01-04 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 4 January 2018 at 17:45:35 UTC, Stijn wrote: Why is it not allowed for a variable name to match a type name? The following example fails with "Error: variable foo conflicts with struct foo" struct foo {} foo foo; Imagine if you then tried to write some

Re: Error: variable foo conflicts with struct foo

2018-01-04 Thread Colin via Digitalmars-d-learn
On Thursday, 4 January 2018 at 17:45:35 UTC, Stijn wrote: Why is it not allowed for a variable name to match a type name? The following example fails with "Error: variable foo conflicts with struct foo" struct foo {} foo foo; How can the compiler know which symbol is which

Error: variable foo conflicts with struct foo

2018-01-04 Thread Stijn via Digitalmars-d-learn
Why is it not allowed for a variable name to match a type name? The following example fails with "Error: variable foo conflicts with struct foo" struct foo {} foo foo;