[squeak-dev] Invariants give guidance here (was Re: A question about #beginsWith: and #endsWith:)
tonyg at leastfixedpoint.com
Fri Apr 22 07:40:15 UTC 2022
On 4/22/22 03:57, David T. Lewis wrote:
> I don't think it is a bug. I can't think of a case where it makes
> sense to say that a string of characters "begins with" or "ends with"
> a string that contains nothing.
I think we (well, certainly *I*) want invariants like the following to hold:
for all X, Y, Z,
`Z = (X, Y)` implies `(Z beginsWith: X) = true`.
Without `(X beginsWith: '') = true`, they don't. I think that's a bug.
(It's a classic (even classical) one, too. This kind of problem arose
with Aristotle's syllogistics and didn't really get properly fixed until
Frege straightened it all out in the 19th century (!). Aristotle has,
contra modern logic, universally-quantified statements false where the
relevant universe is empty; this causes all sorts of havoc, forcing
nasty exceptions everywhere. Anyone interested in going down this
rabbithole will likely find  diverting!)
More information about the Squeak-dev