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

[feature request] compile time check for experimental features #8644

Open
jangko opened this issue Aug 15, 2018 · 3 comments
Open

[feature request] compile time check for experimental features #8644

jangko opened this issue Aug 15, 2018 · 3 comments

Comments

@jangko
Copy link
Contributor

jangko commented Aug 15, 2018

Currently there is no way to know if an experimental feature is available or not during compile time.
They are only listed in --advanced options.
This is important to write code for both experimental and non-experimental version in a project with possibility using different version of nim compiler supporting different set of experimental features.

@Araq
Copy link
Member

Araq commented Aug 15, 2018

Do you need to know whether it's available via .experimental or do you neeed to know whether it's enabled? Probably we need both...

@jangko
Copy link
Contributor Author

jangko commented Aug 15, 2018

The easiest is probably exposing Features via conditional symbols, then we can use when defined(..) syntax to check for it's availability.

Checking if it is enabled or not can be discussed further, as I'm not sure about the mechanism or whether it is really needed or not.

@timotheecour
Copy link
Member

timotheecour commented Dec 2, 2020

reopening, the are 2 issues, only 1 was fixed:

  • whether the compiler supports the flag --experimental:foo (nimHasFoo)
  • whether --experimental:foo is activated in some scope (we currently don't have a way to check for this)

it's easy to support global flag (eg --experimental:foo at cmdline), but what's needed is to tell whether --experimental:foo is activated in some scope, because {.experimental:foo.} can be used in a scope (or pushed in a scope)

this should be done via supporting compileOption("experimental", "foo")

Araq pushed a commit that referenced this issue Aug 12, 2024
#23933)

…s enabled at compile time.

#8644 This doesn't handle the case if `{.push experimental.}` is used,
but at least we can test if a feature was enabled globally.
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

3 participants