Ruby 1.9 does not work with rails. My ruby1.9 cannot work with rails
and
produces an error message about == and >= so why not remove these ?
In activesupport/lib/active_support module ActiveSupport is the
following
module ActiveSupport
if defined? ::BasicObject
class BasicObject < ::BasicObject
undef_method := undef_method :equal?
# Let ActiveSupport::BasicObject at least raise exceptions.
def raise(*args)
::Object.send(:raise, *args)
end
end
else
require ''blankslate''
BasicObject = BlankSlate
end
end
For a start the method as equal? means a.object_id == b.object_id
Getting rid of it seems a mistake
Further the Object.eql? and Object.== are both Object.equal? and the
former two are often redefined at children of object.
Secondly,Within
if defined? ::BasicObject
::BasicObject seems to be an attempt to refers to constant
in Object::BasicObject because
if ActiveSupport::BasicObject
does not seem intelligent. The person who is altering the
same module already knows whether a constant called ::BasicObject
is defined at this same lexical level as the module as ActiveSupport.
Using explicit namespace would avoid my confusion.
Are trying to decide whether ActiveSupport::BasicObject is already
defined?
I presume not.
So assuming that we are trying to discover whether there is a
constant
called ::BasicSupport which refers to an instance of the class as
BasicObject, which is only within ruby 1.9 and not 1.8
From outside of a class and within a module the method as
self.ancestor
needs to be used so to discover constants within are inside of the
scope of the object as Object, such as Object::BasicObject , and to
discover constants within are inside of the scope of the object as
BasicObject, such as BasicObject::BasicObject the method as
Object.ancestors
is required.
When we do this
class ActiveSupport::BasicObject < ::BasicObject
end
we can find a constant called BasicObject with the top level scope
of Object, which is Object::BasicObject because this is referenced
within the definition of a class and this *will* check the top-level
scope without having to make an explicit call to self.ancestors, even
though this class definition is made within a module.
So if the constant as Object::BasicOject is a constant which refers
to
an object which is an instance of the class as BasicObject
we have bypassed the class as Object
Is this correct?
Where have the comparable methods gone?
Are those mixed in at the level of BasicObject. I don''t know the
answer
at present.
What do you think?
Am I wrong? I am new to ruby.
David Roderick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
On 17 Oct 2008, at 15:40, David Roderick wrote:> > Ruby 1.9 does not work with rails. My ruby1.9 cannot work with rails > and > produces an error message about == and >= so why not remove these ? >an error? what error :-)> In activesupport/lib/active_support module ActiveSupport is the > following > > module ActiveSupport > if defined? ::BasicObject > class BasicObject < ::BasicObject > undef_method :=> undef_method :equal? > > # Let ActiveSupport::BasicObject at least raise exceptions. > def raise(*args) > ::Object.send(:raise, *args) > end > end > else > require ''blankslate'' > BasicObject = BlankSlate > end > end > > For a start the method as equal? means a.object_id == b.object_id > Getting rid of it seems a mistake > Further the Object.eql? and Object.== are both Object.equal? and the > former two are often redefined at children of object. >The intent of things like BasicObject is for use as proxies. You want almost everything undefined on these, because you almost always want to forward things like == onto the proxy target. In pseudo code what this is doing is ''if ruby has a BasicObject class, then define ActiveSupport::BasicObject to be like it, if not use blank slate''. Applications (and rails itself) can then use ActiveSupport::BasicObject without having to worry about whether ruby''s BasicObject exists or not. ruby 1.9 is a shifting target so stuff may have broken. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
>> In activesupport/lib/active_support module ActiveSupport is the >> following >> >> module ActiveSupport >> if defined? ::BasicObjectif Object::BasicObject We are looking for a constant in scope of object. Is this correct? It seems to me that BasicObject::Object is the correct order. I have not ruby1.9 at the moment to check this.>> class BasicObject < ::BasicObject >> undef_method :=>> undef_method :equal? >> >> # Let ActiveSupport::BasicObject at least raise exceptions. >> def raise(*args) >> ::Object.send(:raise, *args) >> end >> end >> else >> require ''blankslate'' >> BasicObject = BlankSlate >> end >> end >> >> For a start the method as equal? means a.object_id == b.object_id >> Getting rid of it seems a mistake >> Further the Object.eql? and Object.== are both Object.equal? and the >> former two are often redefined at children of object. >> > The intent of things like BasicObject is for use as proxies. You want > almost everything undefined on these, because you almost always want > to forward things like == onto the proxy target. > In pseudo code what this is doing is ''if ruby has a BasicObject class, > then define ActiveSupport::BasicObject to be like it, if not use blank > slate''. > Applications (and rails itself) can then use > ActiveSupport::BasicObject without having to worry about whether > ruby''s BasicObject exists or not. > ruby 1.9 is a shifting target so stuff may have broken. > > Fred--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---