Skip to content

uninitialized typed global can only be imported qualified and not directly  #54954

Closed
@schlichtanders

Description

Following up on this discourse thread I want to raise awareness to uninitialized typed global variables.

It is an awesome concept which I'd like to use for initializing secret config values at initial runtime (at the start of my main-method).

However unfortunately they can only be imported via qualified access. My case is that I want to import it from a submodule which fails.

  • I.e. importing the entire module like import TopLevelProject and accessing it with TopLevelProject.variable works.
  • but using TopLevelProject: variable gives the error ERROR: LoadError: UndefVarError: variable not defined, even if the variable is not actually used within top-level statements, but just inside functions.

It would be awesome if the variable an already be referenced, even though it is not yet initialized.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions