------art_1853_27728722.1334975076203
Content-Type: multipart/alternative; 
	boundary---art_1854_32690021.1334975076203"

------art_1854_32690021.1334975076203
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit



On Friday, April 20, 2012 8:12:37 PM UTC-4, Matthew Kerwin wrote:
>
> On 20 April 2012 13:53, Intransition <transfire / gmail.com> wrote:
> > The forced distinction only serves to take that flexibility away from the
> > programmer.
>
> Is there not overhead associated with that distinction? I haven't
> actually looked into it, but I'd assume that Modules are a lot more
> light-weight than Classes, because of the things that can't be done
> with them.
>
The Class class is subclass of Module and is almost devoid of it's own 
methods.
 

> > There are other benefits too in that removing the distinction would allow
> > auto instantiation, e.g.
> >
> >     class Foo::Bar
> >     end
> >
> > Would work just fine, even though no `Foo` has been defined separately. 
> This
> > can be especially nice when requiring sub-files.
>
> I can see that this would be convenient, but it also makes me cringe.
> You're defining a namespace Foo without ever explicitly defining it.
> Why? What's its purpose?  How and where is it documented?  I can't
> make my gut instinct accept this as anything but a bad idea.
>
Typically that would be the case -- the encasing module/class would be 
defined *ultimately*. This way it just doesn't have to be done prior to 
classes/module internal to it.

For example in project I often need adapters.

  class MyApp::Adapters::Foo
  class MyApp::Adapters::Bar
  ...

In the myapp/adapters.rb I've would like to write:

  require 'myapp/adapters/foo'
  require 'myapp/adapters/bar'

  module MyApp::Adapters
    ...
  end

But instead I have to do:

  module MyApp::Adapters
    ...
  end

  require 'myapp/adapters/foo'
  require 'myapp/adapters/bar'

I don't like requires at the bottom.

Even so, there are times when it doesn't really matter. If for instance my 
MyApp::Adapters module had no contents other then the adapter classes, then 
it really makes no difference.


------art_1854_32690021.1334975076203
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<br><br>On Friday, April 20, 2012 8:12:37 PM UTC-4, Matthew Kerwin wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 20 April 2012 13:53, Intransition &lt;<a href="mailto:transfire / gmail.com" target="_blank">transfire / gmail.com</a>&gt; wrote:<br>&gt; The forced distinction only serves to take that flexibility away from the<br>&gt; programmer.<p>Is there not overhead associated with that distinction? I haven't<br>actually looked into it, but I'd assume that Modules are a lot more<br>light-weight than Classes, because of the things that can't be done<br>with them.</p></blockquote><div>The Class class is subclass of Module and is almost devoid of it's own methods.<br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><p>&gt; There are other benefits too in that removing the distinction would allow<br>&gt; auto instantiation, e.g.<br>&gt;<br>&gt; &nbsp; &nbsp; class Foo::Bar<br>&gt; &nbsp; &nbsp; end<br>&gt;<br>&gt; Would work just fine, even though no `Foo` has been defined separately. This<br>&gt; can be especially nice when requiring sub-files.</p><p>I can see that this would be convenient, but it also makes me cringe.<br>You're defining a namespace Foo without ever explicitly defining it.<br>Why? What's its purpose? &nbsp;How and where is it documented? &nbsp;I can't<br>make my gut instinct accept this as anything but a bad idea.</p></blockquote><div>Typically that would be thease -- the encasing module/class would be defined *ultimately*. This way it just doesn't have to be done prior to classes/module internal to it.</div><div><br></div><div>For example in project I often need adapters.</div><div><br></div><div>&nbsp; class MyApp::Adapters::Foo</div><div>&nbsp; class MyApp::Adapters::Bar<br></div><div>&nbsp; ...</div><div><br></div><div>In the myapp/adapters.rb I've would like to write:</div><div><br></div><div>&nbsp; require 'myapp/adapters/foo'</div><div>&nbsp; require 'myapp/adapters/bar'<br></div><div><br></div><div>&nbsp; module MyApp::Adapters</div><div>&nbsp; &nbsp; ...</div><div>&nbsp; end</div><div><br></div><div>But instead Iave to do:</div><div><br></div><div><div style="border-style: initial; border-color: initial; ">&nbsp; module MyApp::Adapters<br></div><div style="border-style: initial; border-color: initial; ">&nbsp; &nbsp; ...</div><div style="border-style: initial; border-color: initial; ">&nbsp; end</div></div><div><br></div><div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; ">&nbsp; require 'myapp/adapters/foo'</div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; ">&nbsp; requiremyapp/adapters/bar'<br></div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; "><br></div></div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; ">I don't like requires at the bottom.</div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; "><br></div><div style="border-style:nitial; border-color: initial; border-style: initial; border-color: initial; ">Even so, there are times when it doesn't really matter. If for instance my MyApp::Adapters module had no contents other then the adapter classes, then it really makes no difference.</div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; "><br></div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><p></p><p></p><p></p><p></p><p></p><p></p></blockquote>
------art_1854_32690021.1334975076203--

------art_1853_27728722.1334975076203--