Hello everyone,
What is your experience with using the % operator for accessing an object’s data and procedure members?
Apologies if my complaints seem rude, that is not my intention. I just didn’t have a good experience with using %, and want to voice my experience.
Instead of %, I configured my IDE to show it as either -> or ::
I personally don’t like %, mainly because it makes the code difficult for me to see.
It might differ from person to person, but I have a hard time finding the % character on screen as in,
this%NumCells = abstractKey%CountTotalCells()
Some devs use a space to make things more legible …
this % NumCells = abstractKey % CountTotalCells()
This is somewhat better, but makes us waste lots of white space, and also complicates things when we have other symbols in the equations such as
this % NumCells = abstractKey % CountTotalCells() + oldCells * 2 + this % CountNewCells()
I don’t know if others have faced the same problem, but since we need to have space around %, the equation becomes more spaced out, and makes it difficult for me to see.
Right now, I just simply use a regex search to replace all occurances of % with -> like in C, so the code becomes more easier for me to read.
In neovim editor I can do this easily with the search and replace command :%s/%/->/g
With the changes, the code becomes for a moment …
this->NumCells = abstractKey->CountTotalCells() + oldCells*2 + this->CountNewCells()
I have also tried with another option :: which looks very good to me, and I prefer it to be the best option for me.
this::NumCells = abstractKey::CountTotalCells() + oldCells*2 + this::CountNewCells()
This is a hack, and is not something that I would’ve wanted to do, but it’s necessary for me to being able to see the code better.
The changes can be reversed with a single key press of u, so they don’t change the code. In future I’m trying to use an overlay technique that would prevent modification of the text, and would simply show -> or :: on top of the % instead of replacing it.
I don’t have anything else to say, as this is just me sharing my own experience with using the symbol, and I don’t know if others also have similar experience to me, or not.
Thanks

