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

Interface namespaces #1287

Merged
merged 15 commits into from
Dec 16, 2024
Merged

Interface namespaces #1287

merged 15 commits into from
Dec 16, 2024

Conversation

vyzo
Copy link
Collaborator

@vyzo vyzo commented Dec 16, 2024

This implements namespaces for interface methods, as discussed in #1266.

In brief:

  • each interface has a namespace
  • interface method resolution uses a linearized (c4) search for appropriate methods, bottoming at the unqualified method name (for UX and backwards compatibility)
  • it becomes undesirable (and not easy) to call a namespace method dynamically; you really have to go through the interfrace -- and this is the desirable and safe way to invoke an interface method, as the contract is enforced. It is also now safe to assert the interface method types in the method implementation as you really have to go out of your way to bypass the contract.

Follow up:

  • what is not implemented yet is to validate the method implementation against the interface method signature and in fact inject the signature into the method automatically. This has many benefits (both performance and safety), but it is also more complicated to implement. We can tackle this in a follow up pr.

@vyzo vyzo added this to the Gerbil v0.19: Benko milestone Dec 16, 2024
@vyzo vyzo requested review from fare, drewc and a team December 16, 2024 20:30
@vyzo vyzo self-assigned this Dec 16, 2024
Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for elastic-ritchie-8f47f9 ready!

Name Link
🔨 Latest commit 0f0430d
🔍 Latest deploy log https://app.netlify.com/sites/elastic-ritchie-8f47f9/deploys/67608e0502c9600008d1e0f0
😎 Deploy Preview https://deploy-preview-1287--elastic-ritchie-8f47f9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@drewc drewc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! love the interface: key as it keeps the UI simple.

@vyzo vyzo merged commit 34a09d7 into master Dec 16, 2024
12 checks passed
@vyzo vyzo deleted the interface-namespaces branch December 16, 2024 23:22
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.

2 participants