laria
laria copied to clipboard
Add some sort of feature-gating mechanism
Even in this early stage, a feature gating mechanism would be desirable so that unstable features can be tested without having to hop between branches. An immediate use case for this would be to enable the use of type checking (currently only available on the feature/hir branch), which is incomplete (currently, it can easily be confounded by introducing two definitions with the same name).
My immediate plans for this are to introduce a -Z feature flag in the vein of rustc's -Z feature which would enable unstable compiler features. This works fine for type checking, but in the future there'd need to be a mechanism for enabling unstable language features. This will likely be done with a top-level feature attribute as in Rust:
#![feature(type_checking)]
extern fn print(s: String);
fn main() {
print(4); // error: expected String, got {integer}
}
Progress
- [x] ~~
-Z feature~~-U featurecompiler flag - [ ] Language-level feature gate
The unstable compiler feature flag has been added in 6debb46 as -U feature.