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

Function overloads #1

Open
jchitel opened this issue Nov 9, 2017 · 1 comment
Open

Function overloads #1

jchitel opened this issue Nov 9, 2017 · 1 comment
Assignees
Projects

Comments

@jchitel
Copy link
Owner

jchitel commented Nov 9, 2017

Overloads

New syntactic features:

  • None

New semantic features:

  • Functions can have the same name, so long as the return types are the same
  • Functions will now be stored with a unique id, and a lookup table will point names to lists of ids
  • Anytime a function is used, its name is used to look up the list of overloads, and the arguments are used to determine the correct id, if applicable
  • The most specific argument types are attempted first, in argument order
  • If no assignable function with the right number of arguments is found, it's an error
  • Function references are stored by id for the next step
  • Exported functions will store the list of exported ids
  • Imported functions will import that list

Transformation:

  • The typechecking step stores the correct function id in the module for lookup
  • Nothing else in the process needs to change
@jchitel jchitel self-assigned this Nov 9, 2017
@jchitel jchitel added this to To Do in Ren v0.1 via automation Nov 9, 2017
@jchitel jchitel moved this from To Do to In Progress in Ren v0.1 Nov 9, 2017
@jchitel
Copy link
Owner Author

jchitel commented Nov 9, 2017

Tasks:

  • Refactor Module registry tables to use ids instead of names. Names will be in a separate table that correspond to a list of ids.
  • Refactor function name clash type checking to check for signature instead of name.
  • Refactor identifier type resolution to return the list of possible ids, and function application type checking should narrow that list down to one function.

@jchitel jchitel moved this from In Progress to To Do in Ren v0.1 Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Ren v0.1
  
To Do
Development

No branches or pull requests

1 participant