Perl 6 - the future is here, just unevenly distributed

IRC log for #rosettacode, 2011-03-06

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:32 FireFly left #rosettacode
01:54 shortcircuit FYI: If you use the DuckDuckGo search engine, you can use !rosettacode to search RosettaCode.
02:06 mwn3d_phone ??
02:25 shortcircuit mwn3d_phone: duckduckgo.com
02:25 fedaykin "DuckDuckGo"
02:26 mwn3d_phone Neva hoid of it. Cool enough though is guess.
02:26 shortcircuit It's a search engine. I don't know much about how it works under the hood, but if you use !rosettacode in your query, the rest of the query is converted to http://rosettacode.org/mw/index.php​?title=Special%3ASearch&search={{{s}}}&go=Go
02:26 fedaykin "Search - Rosetta Code" http://rldn.net/xTyC
02:27 shortcircuit I like DDG; I've been using it as my primary search engine for the past two or three months.
02:36 mwn3d_phone left #rosettacode
03:14 mwn3d_phone joined #rosettacode
03:29 mwn3d_phone1 joined #rosettacode
03:31 mwn3d_phone left #rosettacode
03:32 mwn3d_phone1 is now known as mwn3d_phone
06:27 mbishop left #rosettacode
06:32 mbishop joined #rosettacode
06:48 BenBE2 left #rosettacode
07:04 mcandre joined #rosettacode
07:04 mcandre Hey, is this the channel for rosettacode.org?
07:05 sorear yes
07:06 mcandre I'd like to discuss my page "Scripted Main", if anyone's seen it. http://rosettacode.org/wiki/ScriptedMain
07:06 fedaykin "Scripted Main - Rosetta Code"
07:06 mcandre yup
07:06 sorear fedaykin is a bot
07:06 mcandre sorear: Oh, haha.
07:07 sorear don't ask to ask
07:07 sorear say what you want to say, and someone who can help will come eventually
07:08 mcandre sorear: There's discussion that Scripted Main is ambiguous.
07:09 mcandre I created the page to list equivalents to Python's if __name__=="__main__" in multiple languages, because it's very hard to find this behavior on Google.
07:10 mcandre Isn't Rosetta's purpose to clarify/enumerate similar behaviors?
07:12 mcandre left #rosettacode
08:00 BenBE joined #rosettacode
10:20 MigoMipo joined #rosettacode
12:00 FireFly joined #rosettacode
17:22 dom96_ joined #rosettacode
17:33 dom96 left #rosettacode
17:33 dom96_ is now known as dom96
17:33 dom96 left #rosettacode
17:33 dom96 joined #rosettacode
18:23 objeck joined #rosettacode
18:45 waldwolf joined #rosettacode
18:45 waldwolf left #rosettacode
18:45 waldwolf joined #rosettacode
18:49 waldwolf left #rosettacode
18:57 Mathnerd314 joined #rosettacode
19:02 objeck left #rosettacode
19:07 preyalone joined #rosettacode
19:08 preyalone Has any read http://rosettacode.org/wiki/Scripted_Main?
19:08 fedaykin "Scripted Main - Rosetta Code"
19:13 * opticron reads
19:17 opticron I have now read it :)
19:18 opticron it really only applies to languages where execution starts at the top of the file
19:19 preyalone opticron: Aye. I include C for posterity.
19:19 opticron also, wouldn't C barf if some other file included another main?
19:19 opticron since there would be 2 identically named functions?
19:19 preyalone opticron: Yes, unless scriptedmain.h omits the main prototype.
19:19 preyalone opticron: Try it out for yourself.
19:20 sorear The C example is bogus
19:21 preyalone sorear: Explicate.
19:21 sorear basically the page is about making a single file that can function either as an executable or a library
19:22 sorear the C example is not usable as a library
19:22 sorear not portably anyhow
19:22 sorear the presense or absense of a prototype in scriptedmain.h has no effect whatsoever
19:23 preyalone sorear: When I compile scriptedmain.c, scriptedmain's main() runs. When I compile test.c which includes scriptedmain.h, scriptedmain's main() does not run.
19:23 preyalone sorear: Did you test it?
19:23 opticron preyalone, you have to compile scriptedmain.c to actually access its functions
19:23 sorear preyalone: C is defined by a standard, not by whatever your implementation happens to do
19:24 sorear also you seem very confused about how .h files work.
19:24 soniakeys joined #rosettacode
19:24 opticron I agree
19:24 opticron maybe this task is better presented as "Executable as a Library"
19:25 opticron or something along those lines
19:25 preyalone opticron: I couldn't argue with that. I'm glad that you and sorear understand what I'm trying to say.
19:28 preyalone sorear: You're right. Is this better? http://rosettacode.org/wiki/Scripted_Main#C
19:28 fedaykin "Scripted Main - Rosetta Code"
19:30 sorear preyalone: better, but... it's complicated
19:30 sorear I don't think what you're trying to do is C99-portable
19:30 sorear however most linkers have some variant of a "weak symbols" extension that will do what you want
19:31 preyalone left #rosettacode
19:32 preyalone joined #rosettacode
19:33 sorear if main() in scriptedmain.c is defined with __attribute__((weak)), then Scripted_Main#C will work with GCC on ELF platforms
19:33 preyalone sorear: Oo!
19:33 sorear I'm pretty sure the Microsoft C toolchain has an equivalent extension
19:34 preyalone Then... scriptedmain is possible in C/C++?
19:35 preyalone sorear: Could you pastebin an example?
19:36 soniakeys left #rosettacode
19:37 sorear I don't have any working code at the moment
19:38 sorear I agree that "Executable as a Library" or "Runnable Library" would be a better name
19:39 sorear as it stands I get the impression that the LISP examples are not doing at all the same thing as the Haskell and Python versions
19:39 preyalone sorear: __attribute__ ((weak)) resolves compilation errors, but runs scriptedmain's main() in test.c anyway. http://pastebin.com/rnJym8dn
19:39 fedaykin "#include "scriptedmain.h" extern int main() __attribute__ ((weak)); int ma - Pastebin.com"
19:40 objeck joined #rosettacode
19:43 sorear preyalone: __attribute__((weak)) needs to be put on the definition in scriptedmain.c
19:43 sorear hold on
19:45 preyalone sorear: Haskell's scriptedmain works for interpreted scripts, but it's impossible for compiled files, because Haskell expects a single script to be module Main.
19:46 sorear oh right.
19:46 sorear it's been too long.
19:47 preyalone sorear: I've added a caveat to the Haskell section. It will still be useful for those who use runhaskell/runghc.
19:47 sorear preyalone: http://pastebin.com/itrZ7kJ1
19:47 fedaykin "[C] Working Scripted Main#C (GCC/ELF) - Pastebin.com"
19:48 sorear also I strongly recommend that the problem description be changed to include a test() function and two main()s
19:48 sorear like in this example
19:49 preyalone sorear: Good stuff. I'll go through the snippets and make them more like that.
19:50 shortcircuit FWIW, I'm not really worried about whether or not ScriptedMain turns out to be compatible with C99, C++03, C++0x, etc, because I don't believe those standards standardize run-time-linkable behaviors.
19:50 shortcircuit I could be wrong on that, but to my knowledge, they don't.
19:51 shortcircuit In such cases, if questions of standards compatibility exist, it's probably best to describe how the example does and does not interact with the standard.
19:51 shortcircuit That strikes me as the most illustrative and useful approach to that problem.
19:52 sorear C per se standardizes some aspects of the linker.  For instance, two symbols that differ in the first six characters must be treated as distinct. :)
19:52 sorear There are quite a few other standards that add on to C linking behavior
19:53 sorear My version requires an ELF standard linker, and uses GCC syntax extensions
19:53 sorear But any linker that follows ELF will do
19:55 shortcircuit I'll have to take a look at it. On Windows, it's not particularly difficult.
19:56 soniakeys joined #rosettacode
19:58 preyalone I fixed the C and C++ examples, will update Rosetta accordingly. https://github.com/mcandre/scriptedmain
19:59 shortcircuit Was home, now away again.
20:02 sorear http://pastebin.com/WW5yANhh
20:02 fedaykin "[C] Here's an example using classic UNIX static libraries - Pastebin.com"
20:04 preyalone left #rosettacode
20:05 preyalone joined #rosettacode
20:06 sorear http://pastebin.com/WW5yANhh
20:06 fedaykin "[C] Here's an example using classic UNIX static libraries - Pastebin.com"
20:08 preyalone I'll take all the crap about current directory, argv, etc. out. I'll leave those things for other articles. Some scriptedmains will have to access argv in order to work, of course.
20:36 objeck left #rosettacode
20:36 preyalone Does Lua have a convention for function names? I'll just use meaningoflife() if not.
20:41 Hypftier preyalone: not that I know of but you might want to just take a look at the standard library (however small it may be) and Programming in Lua for inspiration
20:45 preyalone left #rosettacode
20:59 mwn3d_phone Is scripted main supposed to demonstrate if the main function/method is callable when its source is imported/included in another program?
20:59 sorear mwn3d_phone: other way around
20:59 mwn3d_phone That is, callable from another class or source file
20:59 sorear it's about including main functions in libraries for self-testing
21:00 mwn3d_phone The other way around is if other libraries are callable from a main method
21:01 kpreid left #rosettacode
21:07 kpreid joined #rosettacode
21:20 BenBE left #rosettacode
21:24 BenBE joined #rosettacode
21:54 mwn3d_phone The new java example in scripted main still doesn't make sense to me. What does it have to do with the main method?
21:57 objeck joined #rosettacode
22:55 MigoMipo left #rosettacode
23:02 objeck left #rosettacode

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary