Obsidian
Obsidian copied to clipboard
Use underscore prefix for private and internal fields
Title says it all. This is to follow Microsoft conventions and remove all redundant this.
es (I'm looking at you @Tides 👀 ).
What's everyone's take on this?
I genuinely think even if it's minor detail that prefixing fields with _ is a sin 🙏
prefixing fields with _ is a sin 🙏
In that case...
I believe prefixing fields with an underscore is a great idea!
@Tides,
I genuinely think even if it's minor detail that prefixing fields with _ is a sin 🙏
It's far from a minor detail though. It falls under the same reasoning we use to adhere to pascal casing for properties and camel casing for variables/fields. It tells you at a glance what you're working with. The reason the convention has shifted to prefixing fields with underscores is to distinguish between fields and local variables (e.g. _fieldName
versus localVariableName
), thus, making code easier to follow at a glance.
@Seb-stian, I'd like to work on this. I assume that the removal of this
is going to be a separate issue?
Also, on a side note, this issue is probably a good candidate for the "good first issue" label since renaming fields doesn't impact functionality.
It's more or so a discussion for now and not something that should be touched 🙏 my point still stands and will not change regardless
@Tides,
It's more or so a discussion for now and not something that should be touched 🙏 my point still stands and will not change regardless
No worries; I don't expect most developers to change their stance on a whim or the word of one or two others, it's usually something we have to get comfortable with on our own before we come to accept it, so I didn't mean any harm, just wanted to point out why the convention was introduced for the sake of others who might be reviewing the issue here.
Also, I didn't see any discussion threads on the topic; is that on the Discord server only at the moment?
@Tides,
It's more or so a discussion for now and not something that should be touched 🙏 my point still stands and will not change regardless
No worries; I don't expect most developers to change their stance on a whim or the word of one or two others, it's usually something we have to get comfortable with on our own before we come to accept it, so I didn't mean any harm, just wanted to point out why the convention was introduced for the sake of others who might be reviewing the issue here.
Also, I didn't see any discussion threads on the topic; is that on the Discord server only at the moment?
It's okay I understand ~ the issue was opened to highlight it's importance and get everyone's take so we can do something about it i believe. No one else has yet to reply to it so it's kinda a slow thing atm 🥲