From: 7stud -- Date: 2007-09-09T22:05:21+09:00 Subject: Re: module_function :func vs. MyModule.func? Logan Capaldo wrote: > On 9/9/07, 7stud -- wrote: > >> What is module_function used for? >> -- > > module_function is used to help give us namespaces. The most visible > example is the Math module. Every method in there is > module_function'ed. > > 2 * Math.sin( 3.4 ) + Math.exp(24) # boy it sure is tiring typing > Math. all the time > include Math > 2 * sin(3.4) + exp(24) # much better Ah hah! A difference I can discern: module MyModule def MyModule.greet puts "hello" end end MyModule.greet #boy it sure is tiring typing MyModule every time I want to say hello include MyModule greet --output:-- hello r1test.rb:10: undefined local variable or method `greet' for main:Object (NameError) -- Posted via http://www.ruby-forum.com/.