[M3devel] scope/resolution of foo in interface foo = foo(bar)

Rodney M. Bates rodney_bates at lcwb.coop
Sat Jan 2 18:42:34 CET 2010



Mika Nystrom wrote:
> Jay K writes:
> ...
>> import foo=3B
>> import foo(bar)=3B
>> import foo(bar) as foobar=3B
>> import foo(bar).T as fooT=3B
> 
> Modula-3 doesn't work like that.
> 
> You have to say
> 
> INTERFACE X = G(Y) ...
> 
> IMPORT X
> 
> You can't import "G(Y)" directly.  Saves having to worry too much about
> name mangling.
> 

On a separate issue, one of the things that the C++ template facility really
botched badly is that instantiations not only can be, but must be, anonymous.
So every single time you want to refer to it, you have to repeat the template
actuals list.  It makes for some very ponderous and confusing code to read,
especially if there are multiple instantiations involved.  It also makes the
semantic analysis unnecessarily difficult for both the human reader and compiler.

In Modula-3 an instantiation must be done once, giving it a simple name, with
the name used thereafter everywhere the instantiation is referred-to.



More information about the M3devel mailing list