Hi Xavier,

Thanks for the reply.

On Monday, December 8, 2014 12:58:59 PM UTC-5, Xavier Noria wrote:

> Given all this context, I don't think it would be a good idea to load the 
> constant your proposal suggests to load. On which grounds would 
> AS::Dependencies special-case that the rightmost segment would have a 
> special treatment if it lacks the nesting? And why
>
>     A::B::C::M
>
> should attempt to load A::B::M? That would be really surprising and 
> AS::Dependencies is not able to distinguish between your example and the 
> constant path above. All it knows is a constant called "M" has been missing 
> in a lookup where a class called "A::B::C" is the first element of the 
> nesting. That's all you know.
>

I hadn't really considered the case where a reference to A::B::C::M 
attempts to load A::B::M, and I agree it would be unexpected. This already 
happens though, in case 1 (just replace the relative reference to M with an 
absolute reference to A::B::C::M.) It seems that while this behaviour is 
definitely not correct, it would be nice for it to at least not be 
order-dependent. It would be nice for the same thing to happen in case 1 
and case 2.

It seems like without breaking backwards compatibility, there's not much 
that can be done here.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to