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

Recursive macro support #3

Open
thomasvrgn opened this issue Mar 15, 2021 · 1 comment
Open

Recursive macro support #3

thomasvrgn opened this issue Mar 15, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@thomasvrgn
Copy link

Adding recursive macro support could transform Orion in a powerful language because :

Recursive macros woudln't be dependent on callstack because they would be translated directly in parsing step. I already see a way of implementing that : Tail call optimisation system.

Recursive macros would just transform some recursive code into simple iterative code.

(macro factorial (x) {
  (if (= x 0) (return 1))
  (return (* x (factorial (- x 1))))
})

Regards,
Thomas.

@Wafelack
Copy link
Owner

Macros like that in an interpreted programming language wouldn't make that much sense in my opinion, because the preprocesor is actually a kind of interpreter, and macros like that would be actual functions. But I still can try to apply that to the recursive functions.

@Wafelack Wafelack added the enhancement New feature or request label Apr 24, 2021
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