Thread overview
Re: Annoying module name / typename conflict
Apr 02, 2012
Andrej Mitrovic
Apr 02, 2012
Jonathan M Davis
Apr 02, 2012
H. S. Teoh
Apr 02, 2012
H. S. Teoh
April 02, 2012
On 4/3/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> However, this name conflict makes this scheme rather painful to use. :-(

For now you can stutter a little bit and use this:
import S : S;
April 02, 2012
On Tuesday, April 03, 2012 00:31:32 Andrej Mitrovic wrote:
> On 4/3/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> > However, this name conflict makes this scheme rather painful to use. :-(
> 
> For now you can stutter a little bit and use this:
> import S : S;

The simplest is just to rename the module so that it's all lowercase. I believe that most people give modules all lowercase names. It's what Walter recommends, but I know that others (e.g. Don) don't like that recommendation. It does solve the problem in this case though.

- Jonathan M Davis
April 02, 2012
On Mon, Apr 02, 2012 at 06:46:07PM -0400, Jonathan M Davis wrote:
> On Tuesday, April 03, 2012 00:31:32 Andrej Mitrovic wrote:
> > On 4/3/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> > > However, this name conflict makes this scheme rather painful to use. :-(
> > 
> > For now you can stutter a little bit and use this:
> > import S : S;
> 
> The simplest is just to rename the module so that it's all lowercase. I believe that most people give modules all lowercase names. It's what Walter recommends, but I know that others (e.g. Don) don't like that recommendation. It does solve the problem in this case though.
[...]

Actually, it doesn't because I have some structs that have lowercase names.


T

-- 
Жил-был король когда-то, при нём блоха жила.
April 02, 2012
On Mon, Apr 02, 2012 at 07:21:53PM -0400, Jonathan M Davis wrote:
> On Monday, April 02, 2012 16:01:38 H. S. Teoh wrote:
> > On Mon, Apr 02, 2012 at 06:46:07PM -0400, Jonathan M Davis wrote:
[...]
> > > The simplest is just to rename the module so that it's all lowercase. I believe that most people give modules all lowercase names. It's what Walter recommends, but I know that others (e.g. Don) don't like that recommendation. It does solve the problem in this case though.
> > 
> > [...]
> > 
> > Actually, it doesn't because I have some structs that have lowercase names.
> 
> Which I'd argue is bad practice, but that's up to you. The typical thing to do is to use PascalCase with type names and camelCase with everything else.
[...]

Yes, I know. :-) But then it's not consistent with built-in type names. But anyway, "import S : S" is an acceptable workaround, so I'll just stick with that.


T

-- 
Obviously, some things aren't very obvious.