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

Signature for built in calls #1648

Open
fbs opened this issue Nov 23, 2020 · 0 comments
Open

Signature for built in calls #1648

fbs opened this issue Nov 23, 2020 · 0 comments
Labels
discussion-needed RFC Request for comment

Comments

@fbs
Copy link
Contributor

fbs commented Nov 23, 2020

I wonder if its doable to write a simple spec for each call that handles this and all the other standard check things for calls (and builtins). E.g.

CallSpec {
 .name = "str",
 .probe_types = any,
 .required_features = {somefeature},
 .min_args = 1,
 .max_args = 2,
 .arg_types = [
  [{ type = integer, literal = true}, { type = pointer } ], // arg0
  [{ type = integer }], // arg1
  .func = &semantic_analyser::call_str
]}

It would remove quite a bit of basically duplicate code everywhere, the deep nested long functions and would help standardize error messages. It should also make it easier to get a quick overview of the calls we have an what kind of arguments they take, might even be possible to generate nice help format output from it.

But there probably are some cases that make it hard to do

Originally posted by @fbs in #1646 (comment)


This should of course integrate with the existing type system, maybe in the form of a new Function type.

@jordalgo jordalgo added RFC Request for comment discussion-needed labels Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion-needed RFC Request for comment
Projects
None yet
Development

No branches or pull requests

2 participants