nnnik wrote:If you want to use a OOP library from another person you need to understand OOP.
That is not true. I can give you an AHK class with instruction on how to use it in your procedural language, such as AHK, which is a procedural language with OOP enhancement. You do not need to have any clue about OOP to use a third party OOP product, you just follow the instructions.
nnnik wrote:If you understand OOP why would you try to access any member directly?
I suppose you have never been curious to try things out just to see what would happen? If so, I believe you to be in the minority. Especially if you are one who likes to tweak things and make them faster. And, you find that a direct assignment to the class variable is faster.
nnnik wrote:I think it's not completely impossible to create a piece of code within AutoHotkey that can emulate the kind of behavior that you are searching for.
A few have, and their code is posted, and some are even referenced in the above comments. But, none work and all take a lot of work, and you have to do it for each and every variable you wish to protect.
nnnik wrote:However rewriting code for that would be a hassle to do every time you want to create a class.
Not just a class, but for every variable in that class.
nnnik wrote:That's one of the arguments I never understood.
Suppose a programmer, Larry, in a particular company got curious and wanted to see what would happen if he did a direct assignment of user input to a third party class his Boss bought for their use in the Application he was working on. In other words, he bypassed the property and did a direct assignment. As he was testing this out, a coworker came by and said, "Let's go to lunch." So Larry quickly saved his work and went to lunch. When he got back, the Boss had an urgent thing for Larry to work on and Larry's direct assignment test was soon forgotten.
As the users of the Application written by Larry and his coworkers were pretty good at entering the correct values, the direct assignment didn't cause any errors. However, as time passed, things changed and the Boss hired the third party to update the class to handle the changes. Some of the numbers that used to work no longer worked and other numbers now changed more than one variable, that is, when a property was used to pass in the number, depending on what that number was, it could cause more than one class variable to be changed. Well, low and behold. When the number was entered by the user of the Application, it was no longer producing the correct results. The Boss got on the case of the third party class developers he bought the class from, but the class developers could find no error with their code and insisted that one of the Boss' programmers were not using the class properly. Of course, now you have egos and pride involved. Oh, in the mean time, Larry found a job closer to home that he liked better and therefore no longer worked there.
The Boss sat down with his programmers and told them what the third party class developer said. So, the Boss' programmers went through the code and eventually found the direct assignment Larry had made in the code. The Boss now humbly apologized to the third party class developers and of course, was angry at Larry, who no longer worked there, for all the headache and time and money wasted because he used a direct assignment instead of a property. Larry wasted not only the Boss' time and money, but delayed other programming work his programmers needed to do. And not only that, he wasted the third party class developer's time and money having to prove the class worked properly, if used properly, and of course, delayed the work the third party class developers needed to do.
The above is just one of numerous examples of why a third party class developer would not want any possible means of direct assignments within their class. Think about the damage a disgruntled programmer could do, going through the Application code and deliberately changing property assignments to direct assignments. Even making it date sensitive, that is, it only used the property assignment until a year had passed since he quit, then from then on, it did a direct assignment. And, lets say he was smart enough to only use the direct assignment on a very random basis averaging one out of 100 times. So, the Application would only produce invalid results on occasion, very hard to track down.
Well, I hope this gives you a little more understanding.