Talk:Modulinos: Difference between revisions

Content added Content deleted
(Suggest that the page name is "Library with optional main" or "Library with scripted main".)
Line 7: Line 7:
:Make of that what you will. Clarification '''definitely''' needed. -- [[User:Eriksiers|Erik Siers]] 07:16, 4 March 2011 (UTC)
:Make of that what you will. Clarification '''definitely''' needed. -- [[User:Eriksiers|Erik Siers]] 07:16, 4 March 2011 (UTC)
:I write command line programs with usage info, flags, etc. I like to combine the exported API with a usable program. Some programming languages have well-known syntax; Python's if __name__=="__main__": main() illustrates this behavior. Other languages, such as Common Lisp, require a hack. I want these hacks to be more easily Googled--I had trouble finding them in the first place. --[[User:Mcandre|Mcandre]]
:I write command line programs with usage info, flags, etc. I like to combine the exported API with a usable program. Some programming languages have well-known syntax; Python's if __name__=="__main__": main() illustrates this behavior. Other languages, such as Common Lisp, require a hack. I want these hacks to be more easily Googled--I had trouble finding them in the first place. --[[User:Mcandre|Mcandre]]

:: This current examples are an awful way to use Python's <tt>__name__ == "__main__"</tt> or Ruby's <tt>__FILE__ == $0</tt>. The Python code exports <tt>scriptedmain.main()</tt> and the Ruby code actually defines a global function <tt>main</tt>, which replaces my global function <tt>main</tt> if I defined one before I required the library. I would like to change the Python and Ruby examples to look like <tt>if __name__ == "main": print "It is %s" % meaning_of_life()</tt>, but I am not sure if the task allows me to do this. --[[User:Kernigh|Kernigh]] 22:40, 6 March 2011 (UTC)



==Name change?==
==Name change?==
Line 20: Line 23:


: ... Which is why I would prefer a more descriptive name that might be more likely to be searched for, like '''"Executable library"'''. --[[User:Paddy3118|Paddy3118]] 12:35, 6 March 2011 (UTC)
: ... Which is why I would prefer a more descriptive name that might be more likely to be searched for, like '''"Executable library"'''. --[[User:Paddy3118|Paddy3118]] 12:35, 6 March 2011 (UTC)

:: I think that "library" should be in the page name. I prefer '''"Library with optional main"''', where the optional main is what runs only when I directly run the program, not when I load the library. '''"Library with scripted main"''' would work if we want to keep the "scripted main" phrase. --[[User:Kernigh|Kernigh]] 22:40, 6 March 2011 (UTC)


== Some chat in IRC ==
== Some chat in IRC ==