------ 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 <<a href="mailto:transfire / gmail.com" target="_blank">transfire / gmail.com</a>> wrote:<br>> The forced distinction only serves to take that flexibility away from the<br>> 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> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><p>> There are other benefits too in that removing the distinction would allow<br>> auto instantiation, e.g.<br>><br>> class Foo::Bar<br>> end<br>><br>> Would work just fine, even though no `Foo` has been defined separately. This<br>> 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? How and where is it documented? 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> class MyApp::Adapters::Foo</div><div> class MyApp::Adapters::Bar<br></div><div> ...</div><div><br></div><div>In the myapp/adapters.rb I've would like to write:</div><div><br></div><div> require 'myapp/adapters/foo'</div><div> require 'myapp/adapters/bar'<br></div><div><br></div><div> module MyApp::Adapters</div><div> ...</div><div> end</div><div><br></div><div>But instead Iave to do:</div><div><br></div><div><div style="border-style: initial; border-color: initial; "> module MyApp::Adapters<br></div><div style="border-style: initial; border-color: initial; "> ...</div><div style="border-style: initial; border-color: initial; "> end</div></div><div><br></div><div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; "> require 'myapp/adapters/foo'</div><div style="border-style: initial; border-color: initial; border-style: initial; border-color: initial; "> 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--