Status of "Duplicate short name" error (Cocoa)

I already found a discussion of the Duplicate short name issue on Cocoa here:

https://talk.remobjects.com/t/duplicate-type-with-the-same-short-name/4083?u=deltics&source_topic_id=9307

But according to the docs, the mangling idea that was contemplated appears to have since been implemented (described in the Platform Notes):

https://docs.elementscompiler.com/Concepts/Namespaces/

But I am still getting this error. Is this a bug in the compiler or an error in the documentation ?

Hard to say without a concrete example…

Duplicate Type Name.zip (10.5 KB)

Two namespaces, each with a Foo public class. Namespaces not referenced in the project but duplicate short name error occurs when building.

Ah: you can’t have both classes public. public implies that names won’t be mangled. As soon as i make one of the classes “assembly” (i.e. just remove the public keyword, your project compiles fine.

Ah, I see. Makes sense. Could be worth adding to that to the doc’s / error message ?

It wasn’t actually an issue in my case since the conflicting names were the result of a refactoring exercise - the same class temporarily was in two namespaces while I refactored, but once that exercise was done one of the namespaces (and the class(es) in it) would be retired. So I simply renamed the soon-to-be-retired class to avoid the conflict in the meantime, but was curious as to why the error occurred. Good to know for the future. Thanks. :slight_smile:

1 Like