import concerns (was Re: Historical language survey)

kris foo at bar.com
Fri Jul 7 12:12:27 PDT 2006


Walter Bright wrote:

> And I still don't know anything about M3 <g>. But being able to extend 
> imports without breaking users can easily be done with some variation on 
> the PIMPL technique or interfaces.

I think you may have missed the point there? It's not about interfaces:

D imports an entire module, into the current namespace (or some 
variation upon that). This means that any additions to the original 
module have to be aware of the namespace usage of *any* module that 
imports the original. Otherwise, a namespace collision will occur and 
the combination will fail to compile. M3 import explicitly from each 
module instead ~ you can't have such a collision. The value of that is 
just as solid today as it was in 1989.

One might argue that with D, one should create new modules instead of 
extending existing ones? That's a fair point until you consider that the 
module namespace is limited to one file, and the 'friend' aspect is 
limited to one module (private attributes being visible within the one 
module). Thus, D suffers this problem in a notable manner.

I forget whether M3 supports importing into a distinct namespace or not 
--- the "import x.y.z. as foo;" syntax -- but that can alleviate related 
problems, and would help resolve the current D namespace conflicts that 
are quite prevalant?




More information about the Digitalmars-d mailing list