[OT] Perl woes
andy at hexten.net
Thu Jan 29 12:05:12 GMT 2009
On 29 Jan 2009, at 02:59, Avleen Vig wrote:
> On Wed, Jan 28, 2009 at 10:56 AM, Jonathan Kimmitt
> <Jonathan.Kimmitt at csr.com> wrote:
>> The next time I use == instead of eq to compare two strings, I
>> will know to expect it will always
>> evaluate to true. What other language does this (apart from C,
>> which would invariably return false)
> Objective C (which is almost C, but different enough), == is used to
> compare if two objects are equal. And by equal, we mean "pointers to
> the same address space".
> As a result, classes like NSString override == and 'isEqual' to
> actually do things like string comparisons. So you can use == on
> string objects just fine :-)
Is that true? I wasn't aware that ObjC did any operator overloading.
The use of == to compare objects (pointers) is valid in C - that's not
something that ObjC has added.
Andy Armstrong, Hexten
More information about the london.pm