Why can't a function have the same name as a variable in a script.gd?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By goshot

Example:

var aname

func aname():
     pass

Result:

Function declaration of 'aname()' conflicts with a variable of the same name.
:bust_in_silhouette: Reply From: Calinou

As of Godot 3.1, using variables with the same name as functions is deprecated. This is because support for first-class functions (lambdas) is expected to land in a future Godot version. Once first-class functions are implemented, this warning will become an error.

Thanks - very useful link. So warning in 3.1, error in 3.2+.

goshot | 2019-07-08 22:10