------ art_45352_11528012.1223326295003
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Not really. This is effectively a rehash of the #uninclude/#unextend
proposal from a few months ago that was summarily ignored despite being
brought up in an implementer's meeting. Maybe with _why pushing it now we'll
see it get its due consideration.
Selector namespaces are much more complex because they need to be applied at
parse-time but evaluated at runtime.
Something like:
class String
def merb:camelize
return self if self !~ /_/ && self /[A-Z]+.*/
split('_').map{|e| e.capitalize}.join
end
end
using(:merb) do
class Merb::Awesome
def some_awesome_method
"hello".camelize
end
end
end
would be expected to call "hello".merb:camelize, even if the call to
some_awesome_method was made outside of a using(:merb) block. On the other
hand, uninclude could be extremely useful (despite the fact that it seems,
at the moment, to require invalidating the global method cache).
-- Yehuda
On Mon, Oct 6, 2008 at 1:20 PM, Austin Ziegler <halostatue / gmail.com> wrote:
> On Mon, Oct 6, 2008 at 3:34 PM, Trans <transfire / gmail.com> wrote:
> > On Oct 6, 2:11 pm, _why <w... / ruby-lang.org> wrote:
> >> While investigating Guy Decoux's old messages, I've recently
> >> discovered a way to do exactly this. It involves inserting a mixin
> >> into the inheritance chain and then enabling and disabling it as
> >> needed.
> >>
> >> <http://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html>
> >
> > Jimmy Crickets! That code is so straight forward. Er... Why isn't this
> > core Ruby?
>
> What I'm wondering is if this might be a way to do selector namespaces
> that everyone has been asking for...
>
> -austin
> --
> Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/
> * austin / halostatue.ca * http://www.halostatue.ca/feed/
> * austin / zieglers.ca
>
>
--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325
------ art_45352_11528012.1223326295003
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<div dir tr">Not really. This is effectively a rehash of the #uninclude/#unextend proposal from a few months ago that was summarily ignored despite being brought up in an implementer's meeting. Maybe with _why pushing it now we'll see it get its due consideration.<div>
<br></div><div>Selector namespaces are much more complex because they need to be applied at parse-time but evaluated at runtime.</div><div><br></div><div>Something like:</div><div><br></div><div>class String</div><div> def merb:camelize</div>
<div> return self if self !~ /_/ && self /[A-Z]+.*/</div><div> split('_').map{|e| e.capitalize}.join </div><div> end</div><div>end</div><div><br></div><div>using(:merb) do</div><div> class Merb::Awesome</div>
<div> def some_awesome_method</div><div> "hello".camelize</div><div> end</div><div> end</div><div>end<br><br></div><div>would be expected to call "hello".merb:camelize, even if the call to some_awesome_method was made outside of a using(:merb) block. On the other hand, uninclude could be extremely useful (despite the fact that it seems, at the moment, to require invalidating the global method cache).</div>
<div><br></div><div>-- Yehuda<br><div class mail_quote">On Mon, Oct 6, 2008 at 1:20 PM, Austin Ziegler <span dir tr"><<a href ailto:halostatue / gmail.com">halostatue / gmail.com</a>></span> wrote:<br><blockquote class mail_quote" style argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class j3C7c">On Mon, Oct 6, 2008 at 3:34 PM, Trans <<a href ailto:transfire / gmail.com">transfire / gmail.com</a>> wrote:<br>
> On Oct 6, 2:11 pm, _why <<a href ailto:w... / ruby-lang.org">w... / ruby-lang.org</a>> wrote:<br>
>> While investigating Guy Decoux's old messages, I've recently<br>
>> discovered a way to do exactly this. It involves inserting a mixin<br>
>> into the inheritance chain and then enabling and disabling it as<br>
>> needed.<br>
>><br>
>> <<a href ttp://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html" target blank">http://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html</a>><br>
><br>
> Jimmy Crickets! That code is so straight forward. Er... Why isn't this<br>
> core Ruby?<br>
<br>
</div></div>What I'm wondering is if this might be a way to do selector namespaces<br>
that everyone has been asking for...<br>
<br>
-austin<br>
<font color 888888">--<br>
Austin Ziegler * <a href ailto:halostatue / gmail.com">halostatue / gmail.com</a> * <a href ttp://www.halostatue.ca/" target blank">http://www.halostatue.ca/</a><br>
* <a href ailto:austin / halostatue.ca">austin / halostatue.ca</a> * <a href ttp://www.halostatue.ca/feed/" target blank">http://www.halostatue.ca/feed/</a><br>
* <a href ailto:austin / zieglers.ca">austin / zieglers.ca</a><br>
<br>
</font></blockquote></div><br><br clear
ll"><br>-- <br>Yehuda Katz<br>Developer | Engine Yard<br>(ph) 718.877.1325<br>
</div></div>
------ art_45352_11528012.1223326295003--