Closed mitchcurtis closed 3 years ago
@Inkane, what do you think? Will we have language features that allow making properties private? Is it worth using the _ prefix?
Will we have a language feature? Yes, but not in 6.2, and who knows when it actually lands. Though I can't say I like the "_" convention; if you really want some notion of privacy, I'd rather use a pattern like
// MyItem.qml
import QtQuick
Item {
property int publicProperty
QtObject {
id: priv
property bool myPrivateProperty
}
}
even though it has a certain amount of overhead.
I take it that we should drop the _ prefix for now, and then introduce the language feature going forward. does that make sense?
That's what I would vote for.
docs/ch06-controls/src/interface-document-window/DocumentWindow.qml has a bunch of properties that start with "_", and one function.
The latter seems to be inconsistent, as the other functions don't have the prefix.
For the former, we should probably decide whether or not we want to encourage the "_ means private" convention or not.