Sujet : Re: Python recompile
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 15. Mar 2025, 12:50:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vr3php$3di63$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
User-Agent : Mozilla Thunderbird
On 15/03/2025 10:42,
Muttley@dastardlyhq.com wrote:
On Sat, 15 Mar 2025 10:18:49 +0000
bart <bc@freeuk.com> gabbled:
There /is/ no build system speak of. Compiling any program even of 100 modules is this invocation:
>
mm prog # prog.m is the lead module
So whats the equivalent of fork() in your language then and how does it work
on Windows?
I've no idea, but this is little to do with a language, or how it is built.
How does it work in C on Windows? Whatever it ends up calling, any language including mine can do the same.
Or you can forget about building completely, and just run direct from source code:
>
mm -r prog # (via native code)
mm -i prog # (interpreted)
>
If there's a simpler way to compile or run source code, I'd like to know what it is!
python3 <filename>
This is running a scripting language. Build processes are associated with languages that normally compile to native code, which are much more complicated especially with no module scheme.
Still, I'll play along: if I copy mm.exe to ms.exe (the name is significant) then I can run from source like this:
ms file # run file.m
In Python you need:
python file.py
Note the '.py' extension if you want to use that. Note also that 'ms' compiles to native code first.
I can go one step further:
c:\qx>ms qc hello
Hello, World! 15-Mar-2025 11:38:38
Here, I'm running a project 'qc' from source code. QC is the lead module of my 250KB scripting language interpreter.
So ms is compiling a 40Kloc program in dozens of source files, into memory, and running it on an input 'hello.q'. The whole thing took 0.1 seconds.
When you can do:
gcc -run python.c hello.py
then come back and we'll talk. That is, doing a fresh compilation of Python from source code, and doing it fast enough that you can do it everytime you want to run a Python program.
C is a little different because the language doesn't allow for automatic discovery of modules. But the extra info needed is simple: a list of files.
Finding dynamic libraries is job of the linker and loader, not the C compiler
Who's talking about dynamic libraries? If your C program consists of 100 different modules, this is about finding out what the other 99 modules are, given the first one.