------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 dirtr">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&#39;s meeting. Maybe with _why pushing it now we&#39;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>&nbsp;&nbsp;def merb:camelize</div>
<div>&nbsp;&nbsp; &nbsp;return self if self !~ /_/ &amp;&amp; self /[A-Z]+.*/</div><div>&nbsp;&nbsp; &nbsp;split(&#39;_&#39;).map{|e| e.capitalize}.join&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp;end</div><div>end</div><div><br></div><div>using(:merb) do</div><div>&nbsp;&nbsp;class Merb::Awesome</div>
<div>&nbsp;&nbsp; &nbsp;def some_awesome_method</div><div>&nbsp;&nbsp; &nbsp; &nbsp;&quot;hello&quot;.camelize</div><div>&nbsp;&nbsp; &nbsp;end</div><div>&nbsp;&nbsp;end</div><div>end<br><br></div><div>would be expected to call &quot;hello&quot;.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 classmail_quote">On Mon, Oct 6, 2008 at 1:20 PM, Austin Ziegler <span dirtr">&lt;<a hrefailto:halostatue / gmail.com">halostatue / gmail.com</a>&gt;</span> wrote:<br><blockquote classmail_quote" styleargin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div classj3C7c">On Mon, Oct 6, 2008 at 3:34 PM, Trans &lt;<a hrefailto:transfire / gmail.com">transfire / gmail.com</a>&gt; wrote:<br>
&gt; On Oct 6, 2:11 pm, _why &lt;<a hrefailto:w... / ruby-lang.org">w... / ruby-lang.org</a>&gt; wrote:<br>
&gt;&gt; While investigating Guy Decoux&#39;s old messages, I&#39;ve recently<br>
&gt;&gt; discovered a way to do exactly this. &nbsp;It involves inserting a mixin<br>
&gt;&gt; into the inheritance chain and then enabling and disabling it as<br>
&gt;&gt; needed.<br>
&gt;&gt;<br>
&gt;&gt; &lt;<a hrefttp://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html" targetblank">http://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html</a>&gt;<br>
&gt;<br>
&gt; Jimmy Crickets! That code is so straight forward. Er... Why isn&#39;t this<br>
&gt; core Ruby?<br>
<br>
</div></div>What I&#39;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 color888888">--<br>
Austin Ziegler * <a hrefailto:halostatue / gmail.com">halostatue / gmail.com</a> * <a hrefttp://www.halostatue.ca/" targetblank">http://www.halostatue.ca/</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * <a hrefailto:austin / halostatue.ca">austin / halostatue.ca</a> * <a hrefttp://www.halostatue.ca/feed/" targetblank">http://www.halostatue.ca/feed/</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * <a hrefailto: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--