Re: Proposal for Include files/headers

Slawomir Lisznianski wrote:

> For clarity, I would recommend that types like Integer, Float and Matrix 
> above be in separate files. The rotate function would then be:
> 
> namespace Math
> {
>   namespace Algorithm
>   {
>     Math.Matrix rotate( Math.Matrix mat, Math.Float deg );
> 
>     // other common algorithms here...
>   }
> }
> 

Actually, since Algorithm, Matrix and Float share common parent 
namespace, it would be even simpler than my example:

namespace Math
{
   namespace Algorithm
   {
     Matrix rotate( Matrix mat, Float deg );

     // other common algorithms here...
   }
}

Now, let's assume that the user decided to add a type within an inner 
namespace with the same name as one in outer namespace, example:

namespace Math
{
   namespace Algorithm
   {
     // Algorithm shouldn't really have types, but let's assume user does
     // the following:

     class Matrix<int>;
   }
}

The problem above is that class Matrix in Math.Algorithm clashes with 
Matrix (primary) in an enclosing namespace Math. What now? Well, in my 
opinion this is a bad design and compiler should complain. Users 
shouldn't be allowed nesting namespaces and re-define outer 
classes/namespaces within inner namespaces. C++ is less strict today. In 
general, I'd rather have an annoying language than unsafe-- of course 
within reason.

--

-- 
Slawomir Lisznianski
C2 Language Group Principal (http://c2-lang.org)

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click

Gmane