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

External library functions not visible #2739

Closed
axic opened this issue Aug 14, 2017 · 2 comments
Closed

External library functions not visible #2739

axic opened this issue Aug 14, 2017 · 2 comments
Assignees
Labels

Comments

@axic
Copy link
Member

axic commented Aug 14, 2017

library L {
  function f() {}
  function g() external {}
}

contract C {
  function f() {
    L.f();
    L.g(); // not visible
  }
}
@axic axic added the bug 🐛 label Aug 14, 2017
@chriseth chriseth self-assigned this Mar 13, 2018
@chriseth
Copy link
Contributor

This was partly intentional. Libraries are seen as implicit base contracts. Since external functions are not visible in derived contracts, external functions cannot be called like that.

Do we want to change that?

In the end, the analogy does not go that far anyway, since calling a function of a base contract will not perform copies in memory while copies are always performed when calling library functions, so basically we do perform an external function call, and thus external functions should also be visible.

@axic
Copy link
Member Author

axic commented Mar 14, 2018

This was partly intentional. Libraries are seen as implicit base contracts. Since external functions are not visible in derived contracts, external functions cannot be called like that.

I think we should just clean the inheritance rules, for libraries too. I'd consider actually prefer going back to the original proposals you didn't like when libraries were introduced: separating the visibility and the inlining aspect of internal. The visibility shows what are internal to the library implementation and what aren't, while inlining just shows inlining. In that sense only external ones would be visible by contracts using libraries.

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

No branches or pull requests

2 participants