Forward referencing functions in D

Ali Çehreli acehreli at
Fri Oct 16 20:59:04 UTC 2020

On 10/16/20 1:47 PM, wilcro wrote:

 > would
 > there be any reason to avoid placing the majority of code for a program
 > outside of the main function?

Keeping scopes of symbols as small as possible is a general guideline in 
D and elsewhere but I wouldn't crowd my main() function with details of 
program logic either. (Aside: There is no global name scope in D; 
everything belongs to a module.)

One thing I love about D is that there are no strong principles like 
that. I code in a way that is comfortable and change things later on as 
a needs arise. :)


More information about the Digitalmars-d-learn mailing list