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

What should spec say about overloading? #769

Closed
jafingerhut opened this issue Jul 8, 2019 · 1 comment
Closed

What should spec say about overloading? #769

jafingerhut opened this issue Jul 8, 2019 · 1 comment
Labels

Comments

@jafingerhut
Copy link
Contributor

jafingerhut commented Jul 8, 2019

There seem to be at least the following possibilities for creating things that can be instantiated at compile time, or called at run time, where multiple possible "targets" with the same name but different parameter signatures exist and should somehow be selected between.

Compile-time:

  • instantiation of extern object, parser, or control with constructor parameters
  • instantiation package with parameters

Run-time:

  • call of action, function, control.apply(), or parser.apply() with parameters

Questions:

  • Should distinguishing between targets be done by arity (i.e. number of parameters) only, or also by types of parameters? If by types, what should the compiler's mechanism be for deciding which target is the right one?
  • For targets that support optional parameters, even arity might not be enough to unambiguously select a target. I have heard that as of 2019-Jul-08, the latest p4c requires distinguishing targets by using "parameter_name = value" at the call site.

One possible response is that this is all a p4c compiler implementation issue, and should not affect the contents of the spec. Even if it should affect the spec, it would make sense if an implementation was done before specifying it, in hopes of keeping spec proposals implementable.

Related issues (likely incomplete):

@jnfoster
Copy link
Contributor

This seems interesting, but in the interest of tidying up our list of active issues, I'm going to mark this as "stalled."

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