[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[objc-improvements] Just remembered something about multiple method sign

From: Ziemowit Laski
Subject: [objc-improvements] Just remembered something about multiple method signatures...
Date: Fri, 5 Sep 2003 11:38:28 -0700

I just remembered a weird corner case that was really occurring in
Apple's code.  Namely, you had several conflicting method signatures,
one of which was returning 'void', while others were returning assorted
non-void values.  It just so happened that the 'void' guy was seen last,
and so the compiler happily plucked it from the hash table. But this was
a wrong choice, resulting in a cascade of errors when we tried to assign
the result of the message dispatch.

At the time, my fix was to special case method dispatching:  If it was
determined that the return type should be 'void', substitute an 'id'
return type instead. :-)  Not pretty, but it worked.

I guess my point is that arbitrarily picking a signature out of a pool
of contenders is fraught with problems, and I still believe that
the IMP fallback is a cleaner solution in this case.  I don't think
doing this breaks (codegen-wise) the counterexample you guys keep
discussing (i.e., where all the candidate methods return NSComparisonResult),
does it?

Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

reply via email to

[Prev in Thread] Current Thread [Next in Thread]