- 0 Posts
- 8 Comments
Unlikely as many Germanic languages have it, with similar meanings. It’s a variant of “ja”, yes. Add a bit of laconicy and you can make “Well.” a sentence in itself.
barsoap@lemm.eeto Programmer Humor@programming.dev•Python needs an actual default function20·15 hours agoHow does executing a program actually work?
Way too long an answer for a lemmy post
It has an executable flag, but what actually happens in the OS when it encounters a file with an executable file?
Depends on OS. Linux will look at the first bytes of the file, either see (ASCII)
#!
(called a shebang) or ELF magic, then call the appropriate interpreter with the executable as an argument. When executing e.g. python, it’s going to call/usr/bin/env
with parameterspython
and the file name because the shebang was!/usr/bin/env python
.How does it know to execute “main”?
Compiled C programs are ELF so it will go through the ELF header, figure out which
ld.so
to use, then start that so that it will find all the libraries, resolve all dynamic symbols, then do some bookkeeping, and jump to_start
. That is, it doesn’t:main
is a C thing.Is it possible to have a library that can be called and also executed like a program?
Absolutely.
ld.so
is an example of that.. Actually, wait, I’m not so sure any more, I’m getting things mixed up withlibdl.so
. In any caseld.so
is an executable with a file extension that makes it look like a library.EDIT: It does work. My (GNU) libc spits out version info when executed as an executable.
If you want to start looking at the innards like that I would suggest starting here: Hello world in assembly. Note the absence of a
main
function, the symbol the kernel actually invokes is_start
, the setup necessary to call a Cmain
is done bylibc.so
. Don’t try to understand GNU’s libc it’s full of hystarical raisins I would suggest musl.
barsoap@lemm.eeto Programmer Humor@programming.dev•They're trying to normalize calling vibe coding a "programming paradigm," don't let them.2·1 day agoPure SQL, as in relational algebra, is LOGSPACE/PTIME. Datalog is PTIME-complete when the program (“query”) is fixed, EXPTIME-hard otherwise.
It’s all quite tractable, but there’s definitely turing-complete declerative langugages. Not just pretty much every functional language, but also the likes of prolog.
barsoap@lemm.eeto Programmer Humor@programming.dev•They're trying to normalize calling vibe coding a "programming paradigm," don't let them.3·1 day agoFunctional is also declarative because control flow is implicit/unspecified.
What’s actually missing is logic programming, of which the likes of SQL are a subset.
barsoap@lemm.eeto Programmer Humor@programming.dev•They're trying to normalize calling vibe coding a "programming paradigm," don't let them.7·2 days agoIt’s fine memes are permitted to make jokes and it’s more of a paradigm than vibe coding.
The one paradigm that’s actually missing is logic programming, I would’ve gotten rid of unstructured to include it. The whole paradigm thing really only started with Dijkstra’s rant about unstructured gotos (not the ones C has, in C you can’t jump to the middle of another function).
Not reliably, no. Python is too dynamic to do that kind of thing without solving general program equivalence which is undecidable.
Use a static language, problem solved.
Your ld.so contains:EDIT: …with which I meant, modulo brainfart: My
libc.so.6
contains a proper entry address, while other libraries are pointing at0x0
and coredump when executed.libc.so
is a linker script, presumably because GNU compulsively overcomplicates everything.…I guess that’s enough for the kernel. It might be a linux-only thing, maybe even unintended and well linux doesn’t break userspace.
Speaking of, I was playing it a bit fast and loose:
_start
is merely the default symbol name for the entry label, I’m sure nasm and/or ld have ways to set it to something different.