Am 09.03.2018 um 23:47 schrieb Allin Cottrell:
So I guess in the long run I'd be inclined to disallow using
strings as
booleans in hansl,
Yeah, let's clean that up and make it easy to understand by having clear
rules.
Given that it's undocumented and only has been present for 1.5 years it
shouldn't be too hard to make the necessary changes to hansl code, such
that it could be done by the release of 2018b.
in which case I'd also be open to your suggestion of
instring() as an (up-front) boolean twist on strstr().
One other perspective on this: at present we (sort of) treat strings as
booleans on the strength of their emptiness or not. But this is
inconsistent in a larger sense, since we don't treat (e.g.) bundles or
arrays in that way (and I certainly would not want to!).
Yes, I've noticed that, too. (Again, opposed to Python, which apparently
always tries to interpret emptiness as falsehood if needed.)
Of course, for bundles, arrays, and matrix we have nelem(). I was also
wondering why nelem() isn't working for strings. I'm aware of strlen,
and it's no big deal, but in principle in the hansl logic I don't see
why nelem("") couldn't give 0 and nelem("abc") couldn't give
3, for example.
thanks,
sven