From: Yehuda Katz Date: 2009-02-26T03:23:18+09:00 Subject: [ruby-core:22478] Re: YASNP (Yet Another Selector Namespace Proposal) --001636e90df95001300463c25730 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable You end up needing to do: Extlib::String.constantize(Extlib::String.to_path(Extlib::String.underscore= (str))) instead of: str.underscore.to_path.constantize Honestly, we tried this in DataMapper for a while, but it got too bulky to be realistic (outside of Java, I suppose). -- Yehuda 2009/2/25 Rados=B3aw Bu=B3at > Yehuda, I wonder on one thing. If you want in your framework/library > custom method behavior, for example String#foo and you want only use > it inside framework/library why not just put it somewhere inside > framework class? For example instead: > "bar".foo > > just do this: > MyFramework.foo("bar") > > ? > > The second is even cleaner and says clearly what method you call. > Using NS you must remember which method you imported to file and which > not. > > > -- > Pozdrawiam > > Rados=B3aw Bu=B3at > http://radarek.jogger.pl - m=F3j blog > > --=20 Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --001636e90df95001300463c25730 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable You end up needing to do:

Extlib::String.constantize(Extlib::String.= to_path(Extlib::String.underscore(str)))

instead of:

str.unde= rscore.to_path.constantize

Honestly, we tried this in DataMapper for= a while, but it got too bulky to be realistic (outside of Java, I suppose)= .

-- Yehuda

2009/2/25 Rados=B3aw Bu=B3a= t <radek.bula= t@gmail.com>
Yehuda, I wonder on one thing. If you want in your framework/library
custom method behavior, for example String#foo and you want only use
it inside framework/library why not just put it somewhere inside
framework class? For example instead:
"bar".foo

just do this:
MyFramework.foo("bar")

?

The second is even cleaner and says clearly what method you call.
Using NS you must remember which method you imported to file and which
not.


--
Pozdrawiam

Rados=B3aw Bu=B3at
http://radarek.jogge= r.pl - m=F3j blog




--
Yehuda Katz
D= eveloper | Engine Yard
(ph) 718.877.1325
--001636e90df95001300463c25730--