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

Already on GitHub? Sign in to your account

Add #instance_exec to exclusions #1

Open
trans opened this Issue Aug 8, 2010 · 14 comments

Comments

Projects
None yet
4 participants

trans commented Aug 8, 2010

Ruby 1.8.7 now has #instance_exec so that should be excluded as well.

Owner

masover commented Aug 14, 2010

You're right.

Unfortunately, I "officially" passed this on to JackDanger, as I don't currently have a use for it or much interest in maintaining it. If you want to fork it, go ahead.

You could also trivially hack around this in your own code with:

class Foo < BlankSlate
  reveal :instance_exec
  # ...
end

trans commented Dec 6, 2011

Is he maintaining it? Your repo is the master repo (and has the issues tab).

I've been thinking about forking it and re-releasing it as basic_object, putting a condition wrapper around it for checking if BasicObject exists. This gem has been useful to me for providing BasicObject support to Ruby 1.8.x.

Owner

masover commented Dec 8, 2011

I don't know if he is, but you could ask.

As I don't have a gem, and I no longer have any reason to implement things on 1.8, I've got no problem with you forking it.

It is odd that he doesn't have an 'issues' tab.

Contributor

kschiess commented Dec 8, 2011

BasicObject and BlankSlate are by no means the same thing, @trans. BasicObject is hardcorer...

trans commented Dec 8, 2011

"no means"? How about "most, but not all, means"? I'm aware of differences. (AFAIK) BlankSlate is as close as one can get to BasicObject in Ruby 1.8, and it generally works as a drop in substitute --I have use it in multiple projects to that end.

Contributor

kschiess commented Dec 8, 2011

Most of the time I use it, it cannot be replaced with BasicObject. That is exactly why I pressed for 1.9 compat of BlankSlate. And yes. I meant no means, perhaps understandably given my first sentence here. (Why is it that with programmers, things that you say lightly in daily life always become such weight? Give me some slack, man. I will help you with keeping BlankSlate alive, isn't that enough?)

trans commented Dec 8, 2011

Probably b/c programs have to be so exact or they go all wonky on us ;-) But point taken. I only meant to say that, while they aren't exactly alike, they largely serve the same purpose. In fact, I believe BasicObject was born b/c people were using classes like BlankSlate.

In my case I am using BlankSlate as a substitute for BasicObject, not the other way around, so maybe that is the difference we experience? On the other hand, I would think you should be able to use BasicObject, there is just a few things you might have to watch out for, e.g. you might need to define const_missing and delegate to Object. You might also need to define some methods BlankSlate doesn't eliminate but BasicObject does.

But rather than speculate, what issues do you specifically run into?

Contributor

kschiess commented Dec 8, 2011

thanks for the slack ;)

You're basically dead on. BasicObject does too little, there is practically nothing left. So you always have to figure out what to add back in, something I find exhausting. For my DSL purposes, BlankSlate was perfect.

PS: I might just bookmark this thread, so I remember from your post above what to add back in ;)

Contributor

kschiess commented Dec 8, 2011

the 1.9 thing was basically fixed (2f31ad4) in May, so I am using this blankslate right here in my projects. Let's just keep it alive for those who do use it, thanks okay bye ;) Reminds me of _why's metaid.rb... Too small to deserve to live? ;)

Contributor

kschiess commented Dec 8, 2011

I hereby offer to maintain it, in the case it absolutely must be moved somewhere.

trans commented Dec 8, 2011

My thought wasn't to kill it, but rather:

# basic_object.rb
require 'blankslate'
unless defined?(BasicObject)
  class BasicObject < BlankSlate
  end
end

Also, metaid.rb lives, sort of. It was incorporated into Ruby Facets.

Contributor

kschiess commented Dec 8, 2011

BasicObject = BlankSlate 

even? I agree, but I am the wrong person to get to agree.

Owner

masover commented Dec 8, 2011

Hmm. I'm not really the right person either...

I do agree that "BasicObject = BlankSlate" is probably the right way to write that patch.

For what it's worth, I think there's another issue with BasicObject -- if I recall, we still have this weird bit where methods can only be rebound to subclasses. That means if I want any methods from Object in BasicObject, I either have to proxy them to a real object with method_missing, or rewrite them from scratch.

By contrast, BlankSlate has a #reveal somewhere.

I haven't run into this at all, though. I've only used it as a replacement for BasicObject, and I've used BasicObject when I have 1.9 available.

So, suggestions: Either we need a new gem name (and basic_object probably isn't the best), or we need to get jackdanger to take over (including the issue tracker somehow), or I can ask him to give me permissions to deploy the 'blankslate' gem on rubygems.org. What do you think?

meh commented Dec 16, 2011

I actually prefer using BlankSlate to avoid constant lookup issues, so please do add instance_exec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment