Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 9987 - Declaring struct ModuleInfo should be allowed #1932

Merged
merged 1 commit into from Apr 25, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Apr 25, 2013

@MartinNowak
Copy link
Member

Thanks for fixing this. Why did you make it dmd2 only?

@MartinNowak
Copy link
Member

It seems to me that we could drop other reserved classnames too if we ensure, that the compiler always uses fully qualified names to access them. The candidates are Throwable, TypeInfo_*, Object etc., not subject to this pull of course.

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 25, 2013

Why did you make it dmd2 only?

The macro constant MODULEINFO_IS_STRUCT relies on DMDV2. So the code enclosed with it is shared between D1 and D2. I'd like to keep D1 code behavior.

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 25, 2013

It seems to me that we could drop other reserved classnames too if we ensure, that the compiler always uses fully qualified names to access them. The candidates are Throwable, TypeInfo_*, Object etc., not subject to this pull of course.

I'm not sure this should be done. Yes, we would be able to remove the limitation, but redefining the names in user code might introduce some confusion. (If redefine Exception, the code try { .. } catch (Exception) {} would be changed not working.)

@ghost
Copy link

ghost commented Apr 25, 2013

Yes and currently some things are allowed, like overriding the definition of string. Even though it is just an alias in object.d, it's a bad idea to overwrite the meaning of this alias.

@MartinNowak
Copy link
Member

I mostly agree with both of you, what we're seeing is an artifact of modelling builtin reserved types with an import of object. Ideally some of these would live in a namespace above the normal one.

MartinNowak added a commit that referenced this pull request Apr 25, 2013
Issue 9987 - Declaring struct ModuleInfo should be allowed
@MartinNowak MartinNowak merged commit cb7b1f5 into dlang:master Apr 25, 2013
dnadlinger added a commit to dnadlinger/dmd that referenced this pull request Jun 13, 2013
After the "fix", Module::moduleinfo might actually point to an
user-defined struct instead of object.ModuleInfo if the user
module is parsed first (e.g. because it is the root module).

This reverts commit cb7b1f5, reversing
changes made to 9ff9c13.
@dnadlinger
Copy link
Member

See #2175.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants