[docs]defset_experimental_features_enabled(enabled:bool)->None:"""Sets whether experimental Guppy features are enabled."""globalEXPERIMENTAL_FEATURES_ENABLEDEXPERIMENTAL_FEATURES_ENABLED=enabled
@dataclass(frozen=True)classExperimentalFeatureError(Error):title:ClassVar[str]="Experimental feature"span_label:ClassVar[str]="{things}{rendered_label_verb} an experimental feature"things:strsingular_things:bool=False@propertydefrendered_label_verb(self)->str:ifself.singular_things:return"is"return"are"@dataclass(frozen=True)classSuggestion(Help):message:ClassVar[str]=("Experimental features are currently disabled. You can enable them by ""calling `guppylang.enable_experimental_features()`, however note that ""these features are unstable and might break in the future.")def__post_init__(self)->None:self.add_sub_diagnostic(ExperimentalFeatureError.Suggestion(None))@dataclass(frozen=True)classNativePythonListsSuggestion(Help):message:ClassVar[str]=("You may be looking for `array` from `guppylang.std.array` or native ""Python tuples.")defcheck_partial_functions_enabled(node:expr|None=None)->None:ifnotEXPERIMENTAL_FEATURES_ENABLED:raiseGuppyError(ExperimentalFeatureError(node,"Partial functions"))defcheck_function_tensors_enabled(node:expr|None=None)->None:ifnotEXPERIMENTAL_FEATURES_ENABLED:raiseGuppyError(ExperimentalFeatureError(node,"Function tensors"))defcheck_lists_enabled(loc:AstNode|None=None)->None:ifnotEXPERIMENTAL_FEATURES_ENABLED:err=ExperimentalFeatureError(loc,"Lists")err.add_sub_diagnostic(NativePythonListsSuggestion(None))raiseGuppyError(err)defcheck_capturing_closures_enabled(loc:AstNode|None=None)->None:ifnotEXPERIMENTAL_FEATURES_ENABLED:raiseGuppyError(UnsupportedError(loc,"Capturing closures"))defcheck_power_modifier_enabled(loc:AstNode|None=None)->None:ifnotEXPERIMENTAL_FEATURES_ENABLED:raiseGuppyError(ExperimentalFeatureError(loc,"`power` modifier",singular_things=True))