You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Certain #pragma-like syntax may be provided for raising errors & warnings when compiling. Some examples:
A) Prevent important unimplemented functions from being compiled
fn important_method(self: MyType) {
@pragma.error("not implemented, don't call me now");
}
fn main() {
let x = MyType::new()
x.important_method() // cause compile error
// note: no compile errors if the method is dead code (not called at all)
}
B) Show library-specified warnings. I believe mainly used for deprecation.
fn old_method(self: MyType) {
@pragma.warning("deprecated since 0.1.5 and will be removed in 0.2.0, use `refreshed_method()` instead")
}
fn main() {
let x = MyType(1)
x.old_method() // cause warning
// note: no warnings if the method is dead code
}
/// @alert deprecated "deprecated since 0.1.5 and will be removed in 0.2.0, use `refreshed_method()` instead"
fn old_method(self: MyType) {
}
For scenario C, perhaps the build system should be responsible for checking the building target. @lijunchen
The alerts are designed to be configurable. You can turn them off or treat them as compile errors by passing the -alert flag to the compiler. For example, -alert -unsafe@deprecated will turn off the unsafe alerts and treat deprecated alerts as errors.
The build system, moon, will support these configuration options in moon.pkg.json and moon.mod.json soon, so stay tuned!
Certain
#pragma
-like syntax may be provided for raising errors & warnings when compiling. Some examples:A) Prevent important unimplemented functions from being compiled
B) Show library-specified warnings. I believe mainly used for deprecation.
C) Prevent certain target from being built.
The text was updated successfully, but these errors were encountered: