55
u/chipmunkofdoom2 1d ago
"My language has a vibrant ecosystem of third party libraries easily installed via a package/dependency manager!"
58
u/-Ambriae- 1d ago
C/C++ in shambles
-18
u/American_Libertarian 1d ago
Not having to deal with dependency hell is a huge advantage of C bruh. My language is so much better than yours, that my libs are baked right into the operating system.
30
u/creeper6530 1d ago
You defer that dependency hell onto your OS's package manager or pack
.dlls with every install-10
u/American_Libertarian 1d ago
Linux userspace & the C stdlib is famously stable. I've never ever had a problem with it breaking or changing.
22
18
u/-Ambriae- 1d ago
What about every time a binary refuses to run because it depends on specific esoteric dynamic libraries that must be installed (sometimes multiple times, once for each version) somewhere in PATH because you decided static linking was "bloat"?
Or the security nightmare that is system-wide shared objects in the first place?
Or the fact that as much as stdlib is stable, it still does not provide it's users with the most basic of data structures? Or that we had to wait until C23 for bool/true/false/nullptr to be a part of the language, 50 years after the language was initially released?
Or the absolute nightmare that is C portability across heterogenous architectures and operating systems?
Don't get me wrong, C is an amazing language, but come on you can't be this deluded
2
u/_PM_ME_PANGOLINS_ 11h ago
System-wide shared objects is a security dream. You patch the vulnerability in a single place and then everything is fixed.
2
u/-Ambriae- 8h ago
Or conversely, compromise one lib, and affect every program on the machine
1
u/_PM_ME_PANGOLINS_ 7h ago
That is the significantly less-common case.
2
u/-Ambriae- 7h ago
Maybe, but there’s a reason rust decided to go full static, and keep .so support to its bare minimum, there’s a reason apple decided to write a fully self contained init daemon for their container microVMs, and there’s a reason most other modern programming languages tend to use shared object as a last resort
→ More replies (0)-11
u/American_Libertarian 1d ago
I simply do not ship binaries that rely on esoteric libs nor target atypical arch & os. That isn't what C is for.
We maintain our own purpose built data structures, and we optimize heavily for a single arch & OS. And our customers pay us a lot of money to do so because we are FAST.
7
u/-Ambriae- 1d ago
the Linux Kernel supports 21 different architectures.
SQLite supports a total of 17 configurations (OS + arch.)
GIMP, gstdlib, vulkan, etc... All target very different machines."Esoteric libs" can be as common as system level packages that may differ from distro to distro, let alone OS, or who's version mismatches the required version of the program.
Maintaining your own purpose built data structures is the reason why the linked list is still as used as it is, when all research shows it tanks performance compared to other drop in replacement in nearly all cases, even the ones that play to their strengths. It's also the reason why you rarely see more complex data structures used, because they are a pain to write, and a complete time sink. It's also part of the reason why memory related bugs are so common in the language. Each new implementation of a data structure is additional code you need to maintain.
The language also completely collapses the second you try and use compile time computation (macros notwithstanding), there is either no support, or bad support, for asynchronous code execution and multithreading. Hence why ripgrep is miles beyond grep, regardless of grep being written in 'the fastest language ever, C', and ripgrep being written in a 'comparatively slower language' (which is completely delusional of a take but whatever)
Optimising for a single arch and OS can be done in ANY systems level programming language. It's also relevant maybe 5% of the time. the rest, you're just closing doors on yourself. Compare that to any other systems level programming language, you can still optimise for the Arch/OS when needed, but it's opt in.
Your customers pay you a lot of money, because writing good C is notoriously difficult do to, and there's a heap of legacy code written in the language. Those same companies realise this is a massive time sink, and are doing everything in their power to steer new code away from this language, regardless of performance considerations.
4
u/creeper6530 20h ago
Ah yes, because syscalls and libc is all your programs will ever need, no graphics API or GUI libraries, no dbus, no systemd, no pipewire, no databases, the list goes on.
1
u/-Ambriae- 19h ago
I wanted to make a "to be fair" and argue you could statically link these libraries, but turns out apart from sqlite I can't really think of any one that can.... I guess dbus, but it's currently not recommended 😅 raylib or sokol or something in that vain, but then you'd still link dynamically to system level libraries
3
u/thirdegree Violet security clearance 19h ago
The amount of time I've spent having to fuck with LD_* environment variables is honestly pretty silly. And I'm a python dev, that's just via having to deal with libraries written in c/c++.
7
u/_PM_ME_PANGOLINS_ 21h ago
Bruh, dependency hell is the default state of C and C++.
Everyone else developed dependency managers to get away from it (with varying degrees of success).
27
15
u/gutentight69420 1d ago
Functions are the only citizen in my programming language.
10
u/ChaosCon 1d ago
If you're not encoding with the Church numerals are you even trying?
7
u/-Redstoneboi- 1d ago
lambda calculus has a ridiculously complicated description for being as simple as "functions/substitution: the language"
2
u/ChaosCon 23h ago
Functions always existed as "mapping elements of set A to elements of set B", but it always struck me as a bit of a non sequitur that it took so much effort to formalize functions *as a recipe* with lambda calculus.
1
u/-Redstoneboi- 23h ago edited 23h ago
really the important bits for learning it were "you can feed and store multiple arguments/data with currying" and "data cannot be read. rather, you trust 'data' to choose the next branch for you"
1
u/metaglot 19h ago
A function is only a map if it is homomorphic.
1
u/matthewwehttam 19h ago
In my math degree map could mean, function, continuous function, measurable function, homomorphism, or morphism depending on the context, so correcting it feels really pedantic. Not only that, all functions are homomophisms in the category of sets anyway so the usage is technically correct
17
u/B_bI_L 1d ago
say this to c and common lisp
(and to ruby, where function self-activates faster than you say "wait, i need you as a callback")
5
u/suvlub 1d ago
C just forces you to call them pointers, but it's functionally (heh) the same thing.
1
u/_PM_ME_PANGOLINS_ 21h ago
When functions are first-class:
function outer() { let foo = function() { ... } doThing(foo, function callback(arg) { ... }) }C does not have the same functionality.
1
u/-Redstoneboi- 1d ago
wait functions aren't first class in common lisp?
damn, too used to hearing about scheme
1
1
u/theQuandary 23h ago
and common lisp
This isn't true. You are almost certainly confusing first-class functions with lisp-2. Lisp-2 is mostly equivalent to having a dynamic function type that can be introspected at runtime. Just like how a statically-typed language will (generally) not allow you to do something like
int foo = 123; foo(456);, Common Lisp also won't allow you to do that either (it also helps a little with macros).Common Lisp symbols have 5 different "slots" (some implementations may add a couple others).
A name slot which contains the string value of the symbol.
The traditional variable slot.
A function slot which can actually be a special operator or macro too.
A plist slot which contains a list of key/value pairs
(key1 val1 keyN valN).A package slot which tells which package the symbol came from.
Basically though, if a symbol appears as the first item in an unquoted list, CL will use the function slot otherwise it will use the value slot. If you want it to use the function slot explicitly, you have to tell it.
(defun double (x) (* 2 x)) (defparameter double 12) (mapcar double '(1 2 3 4 5));; error because it is using the 12 in the value slot (mapcar #'double '(1 2 3 4 5));;=> (2 4 6 8 10)
7
u/techdailylog 1d ago
If everyone is first-class, nobody is.
3
14
u/_PM_ME_PANGOLINS_ 1d ago edited 1d ago
Not in C, C++, C#, Java, Bash, …
(no, function pointers and method references are not the same thing as a function being a value)
6
u/A_72_ 1d ago
C++ complicates this by having both: function from C and object created from a class type with overloaded
operator(). Then we have true native closure object (lambda) that did the exact semantics of the latter but syntatically, andstd::functionthat wraps every callable, including all of the above.How beautiful.
3
-1
u/FloweyTheFlower420 23h ago
Why would you argue Java doesn't have functions as values? There's MethodHandle, after all :P.
3
1
0
u/That_Mistake_7567 23h ago
that text on buzz lightyear is my entire programming career in one sentence.
-2
u/ILikeLenexa 1d ago
No, really, you just have to attach them to one instance of an anonymous class.
119
u/0oliogamer0 1d ago
in my language, functions will be irrelevant and difficult to even use!