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

feat: add function pointer #6066

Open
1 of 2 tasks
j1mbo64 opened this issue Jul 24, 2024 · 1 comment
Open
1 of 2 tasks

feat: add function pointer #6066

j1mbo64 opened this issue Jul 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@j1mbo64
Copy link

j1mbo64 commented Jul 24, 2024

Feature Request

Describe the Feature Request

Cairo function pointer

Describe Preferred Solution

Like in Rust language ( https://doc.rust-lang.org/reference/types/function-pointer.html )

Describe Alternatives

Related Code

fn add(x: i32, y: i32) -> i32 {
    x + y
}

let mut x = add(5,7);

type Binop = fn(i32, i32) -> i32;
let bo: Binop = add;
x = bo(5,7);

Additional Context

If the feature request is approved, would you be willing to submit a PR?
(Help can be provided if you need assistance submitting a PR)

  • Yes
  • No
@j1mbo64 j1mbo64 added the enhancement New feature or request label Jul 24, 2024
@orizi
Copy link
Collaborator

orizi commented Jul 29, 2024

Any specific reason you need it?
(it is planned - but it is a huge and much more difficult feature than you might expect).

We are working on closures specifically - which should take care of a lot of the relevant usecases.

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

No branches or pull requests

2 participants