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

Const vars can be optimized into string blocks #53

Open
enthus1ast opened this issue Mar 12, 2022 · 2 comments
Open

Const vars can be optimized into string blocks #53

enthus1ast opened this issue Mar 12, 2022 · 2 comments

Comments

@enthus1ast
Copy link
Owner

enthus1ast commented Mar 12, 2022

Const variables can be optimized if they're touching a string block, saving an add call

@enthus1ast
Copy link
Owner Author

import macros
const foo = "foo baa"


macro dd(v: typed) =
  when v is static:
    echo "static!"
  else:
    echo "NON static!"
  if v.symKind == nskConst:
    echo "const!"
  else:
    echo "NON const"


dd(foo)

@enthus1ast
Copy link
Owner Author

It seems this is a hard issue: https://forum.nim-lang.org/t/9283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant