Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eigen vs Module methods #101

Open
trans opened this issue Apr 10, 2014 · 3 comments
Open

Eigen vs Module methods #101

trans opened this issue Apr 10, 2014 · 3 comments
Labels

Comments

@trans
Copy link
Member

trans commented Apr 10, 2014

I am considering adding the method alias_class_method to the Module class. However, it seems wasteful to have to add a special method for this, just as it seems wasteful for similar methods like class_accessor. We end up with a bunch of methods that are nothing more then copies of methods that already exist, but acting on the singleton class instead.

Facets has Kernel#eigen which can be used like so:

class Foo
  eigen.alias_method :foo, :bar
  eigen.attr_accessor :baz
end

Not sure I like the eigen name. It used to be called meta but that seemed way too generic. But the question is: Is eigen a better approach? Or should we just be happy with a bunch of extra module methods? Or should we just support both?

@trans trans added the feedback label Apr 12, 2014
@RobertDober
Copy link
Contributor

Without expressing any personal preference I believe that singleton[class], meta[class] and eigen[class] are used with descending frequency.

Personally I prefer metaclass

@trans
Copy link
Member Author

trans commented Jun 8, 2014

Thanks, that helps. I'll start the process of deprecating eigen. The term eigenclass was _why's baby. I suppose he's been gone long enough now.

I'm still not sure if I should bother to add alias_class_method. Which would you prefer to see in code:

class Foo
  metaclass.alias_method :foo, :bar
end

Or

class Foo
  alias_class_method :foo, :bar
end

@RobertDober
Copy link
Contributor

I prefer the first, its semantic is clear for me, although you chose a good name, it still is only a name, I feel it does not enough "work" to justify its existence.
Just my 2c.
BTW
Nice to know about the origin of eigen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants