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

Fix imports #734

Closed
wants to merge 19 commits into from
Closed

Fix imports #734

wants to merge 19 commits into from

Conversation

MartinNowak
Copy link
Member

  • apply protection to aliases added by imports

depends on #739

9rnsr and others added 19 commits March 7, 2012 19:25
compiler segfaults if source file can't be read
Issue 7578 - ICE on indexing result of vararg opDispatch
- restrict visibility of module level symbols to given access rights

- restrict access rights when searching across imported modules
- find private symbols
- take first symbol for ambiguous proposals
- don't report errors for Scope::search_correct
- print protection and kind
- print fully qualified name
- apply protection to aliases added by imports
 - still unfixed
@MartinNowak MartinNowak mentioned this pull request Mar 19, 2012
@andralex
Copy link
Member

This has a few subtleties to it. For example, say we have a private type in a module and a public function that returns a value of that type. Should the function be callable by client code, or not?

@alexrp
Copy link
Member

alexrp commented Sep 25, 2012

@andralex In my opinion, no. While you can do something with it (pass it around using auto and just about nothing else), it's a very sloppy way of doing protection IMO. This pattern is quite literally less powerful than Voldemort types, and I have trouble finding even those useful...

(FWIW C# does not allow exposing something of a type that's less visible than the thing being exposed.)

@MartinNowak
Copy link
Member Author

This has a few subtleties to it. For example, say we have a private type in a module and a public function that returns a value of that type. Should the function be callable by client code, or not?

I don't think we have much room for game changing subtleties in DMDv2.
These are the least code breaking semantics I found that still solves the symbol pollution associated with non-static imports.
IMHO it's a good first step and I'm glad to find similar intentions for C++.

@MartinNowak
Copy link
Member Author

Should the function be callable by client code, or not?

Out of a guts feeling I think getting overly restrictive does more harm than good.
Voldemort types are IMO a useful idiom and I think it should work identically for private types too.

@MartinNowak
Copy link
Member Author

Also D offers fine grained control for protection.

private struct Foo
{
  public void bar() {}
}

vs.

public struct Foo
{
  private void bar() {}
}

@andralex
Copy link
Member

status of this?

@MartinNowak
Copy link
Member Author

I'll have to write a DIP for #739 and do some lobbying for it first.
We can revisit this in time.

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

Successfully merging this pull request may close these issues.

6 participants