StardustPL / Stardust

"A programming language that doesn't make me angry to use it."
https://StardustPL.GitHub.IO/
The Unlicense
4 stars 0 forks source link

Planning: scoped if vs unscoped iff #24

Open LB-- opened 9 years ago

LB-- commented 9 years ago

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-- commented 8 years ago

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.