_isNonEmpty doesn't produce expected results with Text
Summary: Intuitively, users are going to expect _isEmpty and _isNonEmpty to do appropriate things with Text Properties -- that is, test the string length.
Reposting from your email, just so it doesn't fall through the cracks. Feel free to delete.
bare name: true
...The thing is, _isNonEmpty() currently has nothing whatsoever to do with
strings. It is testing whether the collection is empty or not. That is,
if the Property is an Optional, List or Set, this is a way of asking
whether that Collection has contents or not.
... [this] case should
theoretically produce false iff Flavor Text Quote is set to None (that is,
it's an Optional, so it is either None or something) -- but there's a
long-standing and fairly serious Editor design problem that makes it very
difficult to ever have an Optional Text set to None. So your actual value
of Flavor Text Quote is probably a blank string, not None.
I believe the upcoming enhancements to the Editor workflow will help with
this -- the plan is that, if an Optional Text is blank in the Editor, it
will be set to None, so this should start to produce the behaviour you
expect in this specific case.
Separating out this part, which might arguably be considered a different issue:
But that still doesn't help with an
ExactlyOne Text, which by definition is never None. I'm willing to
entertain the notion that isNonEmpty() should be overloaded to do sensible
things in the presence of an empty Text, returning true iff the length is >
0,...isNonEmpty() currently has nothing whatsoever to do with
strings. It is testing whether the collection is empty or not. That is,
if the Property is an Optional, List or Set, this is a way of asking
whether that Collection has contents or not.
Justin: I'm pondering this one. I am likely to make the enhancement, but don't want to treat the question casually, since it is mixing metaphors in a single method. If we do do this, it should be in the context of a more general treatment of the concept of an "empty" value of a type. (Maybe "empty" means the default value? Not sure.) It also might only want to have these semantics iff the Property is ExactlyOne -- the one case where it can't have its usual meaning.