Skip to content

Question: is it a normal practices to use global non-constant variables in Fyne apps #3

@dumblob

Description

@dumblob

I'm quite surprised by the first counter example - namely about the way how the state is being stored and mutated. I'm pretty sure globals are not the standard practice, so I assume one would normally use a local variable in the main() scope.

But the point is, that I'd be also quite surprised if Fyne didn't provide a way to store the mutable state (in this case just an integer) in a more "reactive" manner (e.g. in some "reactive" wrapper which when written to - possibly even from a different go routine - would automagically update all the widgets which read from the "reactive" wrapper instance in their callback).

Does Fyne provide a better support for "live" data (i.e. "reactiveness") than using such plain "global" variables?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions