- From: Bert Bos <bert@w3.org>
- Date: Thu, 3 Apr 2008 14:49:30 +0200
- To: www-style@w3.org
On Thursday 03 April 2008 00:25, Bjoern Hoehrmann wrote: > * Bert Bos wrote: > >I don't care whether the empty string matches everything or nothing > >(although I suspect that most people will not consider the empty > > string to be a prefix of anything), but I think we should be > > consistent. > > They would generally expect that starts-with($x, $x) returns true for > any string $x, however, If we're talking about the same "they," I think they'd have no clue what you're talking about :-) And if they do, they probably don't agree with you. "abc" doesn't start with "abc", because they are the same. I tried asking some people if "abcd" starts with "abcd" and if "abcd" starts with "", but I didn't even get beyond the question if "abcd" starts with "ab". They didn't understand what "abcd" and "ab" meant and thus couldn't answer the question. One who tried considered that "abcd" starts with "a...". And also considered that "Jean" starts with "je". She recognized in "" a philosophical problem about the infinite and the infinitely small, but didn't know how to answer the question. And when I tried computer scientists, I got more predictable results, but still not all the same. In particular, I got a (minority) response that "" is not a text and thus doesn't start anything, and that asking if "" occurs in a string is meaningless as well, because you can't construct the text with pieces of nothing, not even with infinitely many of them. > which is also how XPath handles the issue > (the empty string is a substring of any string, so any string starts > with and ends with it). The analogous of [example~=""] does not match > be- cause the empty string is not a token so it cannot be in the > token set. As I said, I don't care what we define, either way will be non-intuitive to some people. But I'd rather not have to explain one point of view and its opposite at the same time. People will accept it, but they'll think we're nuts. If programmers prefer that starts-with(x, x) is true for all strings x, I'm fine with taking that as a principle and explaining to other people that "" is a prefix is of everything, because, well, we had to define it one way or the other and this was easiest for programmers. But then we'll have to change our resolution on the issue again. Bert -- Bert Bos ( W 3 C ) http://www.w3.org/ http://www.w3.org/people/bos W3C/ERCIM bert@w3.org 2004 Rt des Lucioles / BP 93 +33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Thursday, 3 April 2008 12:50:17 UTC