[M3devel] imports anywhere?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Mon Feb 11 17:50:54 CET 2008


On Mon, Feb 11, 2008 at 11:40:11AM -0500, Tony Hosking wrote:
> I hate imports that are scattered throughout since it hides  
> dependencies deep in the guts of the code.  Much better to have them  
> explicit at the top!
> 
> On Feb 11, 2008, at 7:48 AM, Jay wrote:
> 
> >Here is another SMALL gripe with the language.
> >The need to put IMPORTS at the top (or is it just common style?),  
> >leads to something I have seen several times.
> >You comment out some code, thereby deleting the only/last use of  
> >some import, that nets you warnings about unused imports. Granted,  
> >they are "only" warnings, but I try to have none. Also granted, you  
> >can either comment out or just go ahead and remove the imports, easy.
> >
> >It might be nice if the IMPORTS could be adjacent to the code using  
> >the IMPORTS, so that they can be comment out or removed together.
> >
> >This "problem" is not unique to Modula-3, by far.
> >In fact, Modula-3 is probably more able to warn about this low cost  
> >waste due to its much better module system, compared to say, C and C 
> >++ #includes..
> 

I don't know if this is still the case, but long long ago, when I was 
reading the OS/2 port of Modula 3, there seemed to be an early phase 
that determined which source files had to be compiled.  It could 
determine this from just the beginnings of the source files, and did not 
have to do full-scale Modula 3 parsing.

I thought it a clever engineering trick.

-- hendrik




More information about the M3devel mailing list