Checking if a string is null

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Jul 30 04:06:09 PDT 2007


Manfred Nowak wrote:
> Bruno Medeiros wrote
> 
>> But it _also implies_ there is one element which
>> is less (or more) than all the others, so there is a "minimal
>> element". 
> 
> I do not see this implication, although it might be true. All I asked 
> was: "where is a proof" of this, because I do not believe it? If it is 
> implied, then it should be very easy to prove, so please prove it.
> 
> 
>> which is how often the function/relation has a false value
> 
> For identity relations, that number is identical to the number of 
> equivalence classes taken to the power of two.
> 
> 

Do you doubt the implication, or the statement on Java's spec?
In any case:

The phrase "X is the most Z" implies that X is the maximal element 
regarding to Z, and that it is unique (ie, the only maximal element). 
There is no doubt that this *implication* is *valid*, that is simply the 
nature of that natural language statement.

If you accept the implication, but instead are doubting that the 
statement "X is the most Z" is true, well, first of all, the Java spec 
says its true, so I *believe* it is true :P .
But I also intuitively understand, that such implementation is, of all 
possible valid equals implementations, the one with returns the most 
false values for all possible inputs, thus being the most 
discriminating. Can I prove it formally? Maybe, if I worked on it, but I 
really have no interest in doing so, because that seems to me something 
that should be clearly understood by any programmer/scientist.
I'm frankly surprised you doubt it, but I have to say that's your 
problem. You come up with a proof of its falseness if you are interested.


>> ie. they have the same identity
> 
> Now you are writing that Java's "equal" is D's "identity", but you 
> proposed Java's definition of "equal" to be usuable for D's "opEqual". 
> I see a contradiction in this.
> 
> -manfred 

No, what I said was that Java's Object.equals operates using object 
identity (ie, its the same as Java's "==" and D's identity), however 
Object.equals is only the *default implementation* of equals. If you 
have a class that supports a semantic notion of equality, then you are 
supposed to *override* Object.equals and provide a different 
implementation, one that is according your class's semantics (as well as 
the Object.equals contract).

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list