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

Listing all preview feature flags #543

Open
HertzDevil opened this issue Aug 27, 2021 · 1 comment
Open

Listing all preview feature flags #543

HertzDevil opened this issue Aug 27, 2021 · 1 comment

Comments

@HertzDevil
Copy link
Contributor

HertzDevil commented Aug 27, 2021

From crystal-lang/crystal#11145 (review), there should be a place where every compile-time flag for breaking feature previews is listed. This list should be public and contained in the language reference itself. For example:

Specification - Compile-time flags

To define a flag, simply use the --define or -D option, like so:

crystal some_program.cr -Dflag

A flag that starts with preview_ enables a preview compiler feature (link).

Specification - Preview compiler features

A preview compiler feature changes the behaviour of the compiler in a way that may prevent existing code from working. In other to maintain compatibility, these features are enabled by compile-time flags (link), and will be enforced in Crystal 2.0 or turned into warnings some time before a 2.0 release. All preview feature flags must start with preview_. The currently supported preview compiler features are:

* preview_multi_assign (link): Enables stricter checks on one-to-many multiple assignments.

Preview compiler features are experimental and subject to incompatible changes even between minor releases.

Specification - Preview compiler features - Multiple assignment

(the full specification of changes applied by preview_multi_assign, as well as any migration paths applicable)

Specification - Assignment - Multiple assignment

If the right-hand side contains just one expression, the type is indexed for each variable on the left-hand side like so:

# ...

If the preview_multi_assign flag (link) is enabled, the number of elements in that expression must match the number of assignment targets.

@straight-shoota
Copy link
Member

There should probably be notes which version introduced a preview flag, if and when it was accepted to be final and if and when its absence leads to deprecation warnings.

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

2 participants