"Builds an executable that doesn't require any julia source code":
[great that this is possible..] https://github.com/JuliaLang/julia/blob/master/contrib/build_executable.jl I see from: "<cpu_target> is an LLVM cpu target to build the system image against" that, as expected, your executable will no longer be cross-platform. It is very desirable to distribute source code (some might want to hide it, that is another issue) and can still expect your code to run (at full speed). A. Now, you have either that or binaries (I haven't really checked out that option), but wander if you could get both at the same time with a polyglot that works with (I guess) Powershell (or whatever you can expect to be installed on Windows by default. Are there good other options?) and whatever scripting language/shell you can except by default on Linux/OS X/Unix-like. B. Possibly the polyglot would run wget or whatever else that does the same thing on Windows to download the right binary runtime Julia. What would external default command in Windows would that be? A showstopper or an inbuilt one in Powershell? Would a better option be to include the runtime as machine code [on Windows or at least code to download it]? Allow both options? They both have pros and cons.. Anyone know if something like this has been done before for some non-Julia project as it isn't strictly a "Julia issue"? Any pointers/where to ask about? Anyone think this is impossible..? Or not worth trying/too brittle? A bonus would be if this would work on Android.. (or other than the default three/four? platforms) but not really a priority.. [JavaScript/the web is the only cross-platform scripting language I know, but would not work as you would have to break out of the sandbox and that would be a security issue.. Still, targeting [compiling Julia to] JavaScript for running in a browser is also an interesting alternative to run Julia programs, but not the idea here and has some cons..] https://en.wikipedia.org/wiki/Polyglot_(computing) "The term is sometimes applied to programs that are valid in more than one language, but do not strictly perform the same function in each. One use for this form is a file that runs as a DOS batch file, then re-runs itself in Perl: @rem = ' --PERL-- @echo off perl "%~dpnx0" %* goto endofperl @rem '; #!perl print "Hello, world!\n"; __END__ :endofperl This allows creating Perl scripts that can be run on DOS systems with minimal effort." Something like this where you have to compile is a non-starter/not what I had in mind (but still interesting): http://ideology.com.au/polyglot/ You compile it with your favorite compiler and run it. It says: hello polyglots It supports the following languages: COBOL (ANSI) Pascal (ISO) Fortran (ANSI, f77) C (ANSI-ish) PostScript Linux/Unix shell script (bash, sh, csh) x86 machine language (MS-DOS, Win32) Perl (version 5) There are some example on the first page up to 16 languages (but not it seems targeting the right scripting languages): A polyglot in 16 different languages https://raw.githubusercontent.com/mauke/poly.poly/master/poly.poly I can see at least in the source code: I'm a Literate Haskell program I'm a Python program I'm a HTML page [I'm a] horrible HTML [page] JavaScript I'm a Perl6 program -- Palli.
