ruby picture

RCR 347: object_class

Submitted by transami (Thu Sep 14 08:39:49 UTC 2006)

Abstract

As with the transistion from #id to #object_id, it would be advantageous to move from #class to #object_class.

Problem

Unlike other methods, #class always requires the prepending of self, e.g. self.class, to disambiguate it from the class keyword. Using #object_class instead avoids this clash and is nicely symmetrical with #object_id. It would also be more convenient in allowing public methods, local variables and database fields to use the term 'class' rather then poor alternatives like 'klass'.

Proposal

It's a three part proposal. First add support for #object_class. Sometime later add a warning that #class will be deprecated. And finally, at some later date complete the deprecation.

Analysis

This is the same transistion that has taken place with #id, but applied to #class.

Implementation

alias_method :object_class :class
ruby picture
Comments Current voting
I am neutral on the RCR, maybe a tiny bit in favour as it seems reasonable. However i'd like to point out on something else, maybe not as important but still - since it was mentioned, please do not use things like "klass", including "eigenklass" or "eigenclass" - the word sounds very very strange for those that understand german :)


I think this is a logical step to take


Strongly opposed 0
Opposed 2
Neutral 1
In favor 7
Strongly advocate 2
ruby picture
If you have registered at RCRchive, you may now sign in below. If you have not registered, you may sign up for a username and password. Registering enables you to submit new RCRs, and vote and leave comments on existing RCRs.
Your username:
Your password:

ruby picture

Powered by .