On Fri, 23 Aug 2013 17:08:59 +0000
Roman Fleysher <roman.fleys...@einstein.yu.edu> wrote:

> This leads to enormous growth in number of types. Another solution is
> to realize that the comparator (the thing that makes comparisons) is
> actually an object of its own

An operation is not an object. SQL has no objects.  The "enormous
growth in number of types" does not exist; at present in SQLite, after
a decade of development, that number is less than 10.  

> the rules of equality -- of any comparison -- are governed by the
> attribute(s) of the object relevant for comparison. 

Yes, because those attributes -- what I called "properties" -- define
the type.  

> What is relevant is not determined by the type of the object, but by
> the task at hand, in other words by the comparator.

No.  There is only one meaning of "equal".   Two things are either
equal or not.  How to compare them is determined by only their type. 

In mathematics, the concept of "equal" is so basic that it has its own
symbol. In computer science, we can think of it as a binary function:
two inputs producing a Boolean output.  Those inputs are the function's
only source of information.  There's no third parameter governing the
function's behavior.  

Strings are not unique in that regard.  Consider floats and integers.
How to compare

        5.5 = 5

where the latter is an integer?  By implicit conversion: 

        5.5 = 5.0 -- false

or explicit conversion: 

        CAST(5.5 as INT) = 5 -- true

Not by modifying '='.  

The principle is the same with strings even though, as you point out,
they have potentially many properties.  Other DBMSs, for instance,
support cultural and linguistic properties for character data, thus
affecting whether e.g. 

        'resume' = 'résumé'

is true.  In English the strings are equal because the accents are
mere decoration; in most other languages they are distinct because
they bear semantic information.  (It gets even trickier because two
columns may use different encodings.  People sometimes assume that
"equal" means "same bytes in same order", but it really means "same
letters in same order", where "letter" is defined culturally.)  

HTH.

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to