This is how you can treat a Godot variable like a property in C#, where access to its value is encapsulated in some way:

@export var foobar: Array = [] :
    get:
        return foobar
    set(value):
        foobar = value

Note that the syntax here is special so that accessing foobar in the example above actually accesses the underlying value instead of causing infinite recursion.

Source: docs.godotengine.org