Hi folks!
I’m working on a module to assist with object oriented programming in luau. I’m currently implementing private / public (and maybe protected) access specifiers, and I’m trying to gauge interest in those features. Would access specifiers be useful to you? Would love to know your thoughts!
For those who don’t know, access specifiers are a feature of other languages (I’m taking inspiration from C++) which mean that you can only access certain keys of a table from certain places in your code. For example, if I had a SecretKeeper class that had a private member called ‘secret’, trying to access this from outside the class would throw an error. However, I could implement a ‘getSecret’ method, which would return the secret to pieces of code outside the class. Because the method is a member of the class, it has access to the class’s private members.
Access specifiers are useful for putting together large projects, as they help ensure that your class can only change in the ways you specify it can change. They also help encapsulate information so derived classes don’t have access to internal workings of higher-up processes.
So yeah, would you use this feature in your development? Cheers!