T. Onoma
12/15/2004 1:01:00 AM
On Tuesday 14 December 2004 07:22 pm, Florian Gross wrote:
| trans. (T. Onoma) wrote:
| > | |> It bypasses #<=> for objects of class String and subclasses
| >
| > Sorry, how does that provide better performance? Simply b/c it can't be
| > overridden?
|
| It does not need to go through method lookup and so on.
I see. Thanks. If I may then, perhaps there is prudence in having Ruby support
documented non-overridable methods --at least in core. This would bring such
"creatures" out of the shadows of exception into formal, documented
acceptance. For instance, in the current case, Ruby could define #quicksort
(or some such name) to bypass <=> and be non-overridable, while #sort itself
could still use the reusable, albeit slower behavior. This would provided the
best of both alternatives.
T.