Skip to content

operations to implement in expreval #826

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

Open
1 of 5 tasks
metagn opened this issue Mar 20, 2025 · 0 comments
Open
1 of 5 tasks

operations to implement in expreval #826

metagn opened this issue Mar 20, 2025 · 0 comments

Comments

@metagn
Copy link
Collaborator

metagn commented Mar 20, 2025

Hopefully expreval will not need to be a full fledged VM but there are still operations we probably need to support for basic const evaluation.

Implemented as magics:

  • arithmetic, comparison
  • numeric type conversions, casts
  • sizeof etc
  • set ops

Implemented as procs in system but will probably be specialized in expreval:

  • string ops, maybe just basic ones like &, len, comparisons, as strings are represented by string literal tokens in expreval
  • seq ops and openarrays are probably not used too commonly
  • maybe set ops can be implemented as procs and overriden in expreval as well

These could be implemented via pragmas like {.vmop: "string.len".} or by hard coding the symbol names in the compiler which might get annoying. But the pragmas would probably build a table from symbols to their respective operations anyway, just at compiler runtime.

Pure function calls in consts/array length exprs are also common but most likely not necessary for the standard library. Templates should work though.

@metagn metagn mentioned this issue Mar 20, 2025
2 tasks
@metagn metagn self-assigned this Mar 20, 2025
@metagn metagn removed their assignment Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant