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

Planning: scoped if vs unscoped iff #24

Open
LB-- opened this issue Apr 30, 2015 · 1 comment
Open

Planning: scoped if vs unscoped iff #24

LB-- opened this issue Apr 30, 2015 · 1 comment
Assignees
Labels

Comments

@LB--
Copy link
Member

LB-- commented Apr 30, 2015

In nearly all languages, if is scoped - that is, variables declared within its scope are inaccessible to the enclosing scope. Some languages have another kind of if statement which is unscoped, for instance the C #if preprocessor directive.

The unscoped iff statement will be identical to the if statement except that it has no impact on scope. Both the scoped if and unscoped iff may appear in any scope (e.g. not within a function scope), this is only really useful for iff to make conditional declarations.

@LB-- LB-- added the planning label Apr 30, 2015
@LB-- LB-- self-assigned this Apr 30, 2015
@LB--
Copy link
Member Author

LB-- commented Jul 13, 2016

I want to elaborate on this. The condition must be labeled and all code that accesses the conditional declarations must be in iff statements with the same conditions. && should probably also be allowed, but how freeform should this become? I worry that unrestricted usage is no better than #if in C.

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

No branches or pull requests

1 participant