Re: Forward declaration inside Function block, no error?

2019-01-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/7/19 12:20 AM, Jonathan M Davis wrote: On Sunday, January 6, 2019 11:38:44 AM MST Benjamin Thaut via Digitalmars-d- learn wrote: Today I found a bug in my D code. import std.stdio; // Type your code here, or load an example. void grow() { writeln("grow"); } void someFunc(bool

Re: Forward declaration inside Function block, no error?

2019-01-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, January 6, 2019 11:38:44 AM MST Benjamin Thaut via Digitalmars-d- learn wrote: > Today I found a bug in my D code. > > > import std.stdio; > > // Type your code here, or load an example. > void grow() > { > writeln("grow"); > } > > void someFunc(bool condition) > { >

Re: Forward declaration inside Function block, no error?

2019-01-06 Thread Neia Neutuladh via Digitalmars-d-learn
On Sun, 06 Jan 2019 20:19:59 +, Rubn wrote: > You can declare functions inside of functions in D. You weren't forward > declare grow() in the module namespace, so much as you were forward > declaring a new function grow. Unfortunately, you can't do forward declarations for nested functions.

Re: Forward declaration inside Function block, no error?

2019-01-06 Thread Rubn via Digitalmars-d-learn
On Sunday, 6 January 2019 at 18:38:44 UTC, Benjamin Thaut wrote: Today I found a bug in my D code. import std.stdio; // Type your code here, or load an example. void grow() { writeln("grow"); } void someFunc(bool condition) { if(condition) { void grow(); } } I tried

Forward declaration inside Function block, no error?

2019-01-06 Thread Benjamin Thaut via Digitalmars-d-learn
Today I found a bug in my D code. import std.stdio; // Type your code here, or load an example. void grow() { writeln("grow"); } void someFunc(bool condition) { if(condition) { void grow(); } } I tried to call the grow function, but accidentially copied the return