In the Brighterscript language, the @. operator is used to replace the callFunc method when invoking functions on a node. In regular BrightScript, we would write code like this to invoke a function on a node:
userManagerNode.callFunc("login", username, password)
This syntax is not only ugly, but it’s also error-prone due to the use of string function names. It’s also not very navigable, making it difficult to quickly find and modify the code.
Brighterscript addresses these issues by using the @. operator, which allows us to write the same code like this:
[email protected](username, password)
This syntax is not only more legible, but it’s also more maintainable and navigable. In an editor like Visual Studio Code, the @. operator makes it easy to see which functions are being called on a node, and to quickly navigate to those functions.
Overall, the @. operator is a powerful tool that makes it easier to write and maintain code in the Brighterscript language. If you’re a Roku developer, I highly recommend using it in your Brighterscript files (.bs files) to improve the legibility, maintainability, and navigability of your code.