this post was submitted on 21 Jan 2024
9 points (90.9% liked)

Programmer Humor

32469 readers
440 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 9 months ago (1 children)

I enjoy the selection bias in the comments for these sorts of posts. >_< There's a few people saying "I kinda like C", a few saying "use Python instead", and a whole lot saying "Rust is my lord and savior". Completely disjoint from the real world usage of the languages for whatever practical, pragmatic, or ideological measures they are used for.

[–] [email protected] 0 points 9 months ago (1 children)

I know barely anything about programming languages and only ask as a fan, what are the real world usages of languages and what are their practical, pragmatic, or ideological measures that they are used for?

[–] [email protected] 0 points 9 months ago

I guess by real world usage I mean what proportion of code is being made with them. You should be skeptical of their accuracy, but there are measures for that. Like there is this one: https://www.tiobe.com/tiobe-index/, but it describes it's methodology as being about popularity based on articles, news, and other such things. Github publishes a very different chart as does RedMonk. Rust barely shows up on these charts, but Rust fans are very enthusiastic in threads like this. I like Rust well enough, but I also find the over-enthusiasm amusing.

By practical/pragmatic I mean the ability to target a lot of hardware with C. Sometimes the tooling is crap, but it's very universal. Being built on LLVM Rust can go onto plenty of hardware too, but it's probably not the tooling given to you by a platform vendor. It's also been around for a long time, so using Rust would mean a rewrite. Sometimes C is simply the choice. As for ideologically: Rust solves some pretty nasty programming issues, but sometimes I think it's fans over-estimate the percentage of real world problems it actually solves while ignoring that Rust can be more expensive to write. (shrug) Sometimes there's no such thing as a silver bullet.

[–] [email protected] 0 points 9 months ago

my controller may be old, but i only pay 20 thousands eurodogs for a board support pckage ,per user per ip per nation per year. I dont even pay for their eclipse ide! C is the laand of free fuck yeah! My debug partner is compatible with only 200 euro per flexcable. Don`t tell em my debrugs parnter is not oem spec🐵.

[–] [email protected] 0 points 9 months ago* (last edited 9 months ago) (1 children)

Primitive, provincial knuckledragging Americans/Brits/Right-wing country's citizens don't want to learn C or understand how their computer truly works. 😆

Yeah. That tracks

[–] [email protected] 0 points 9 months ago* (last edited 9 months ago)

C is not how a computer truly works.

If you want to know how computers work, learn assembly and circuit design. You can learn C without ever thinking about registers, register allocation, the program counter, etc.

Although you can learn assembly without ever learning about e.g. branch prediction. There's tons of levels of abstraction in computers, and many of the lower level ones try to pretend you've still got a computer from the 80s even though CPUs are a lot more complex than they used to be.

As an aside, I've anecdotally heard of some schools teaching Rust instead of C as a systems language in courses. Rust has a different model than C, but will still teach you about static memory vs the stack vs the heap, pointers, etc.

Honestly, if I had to write some systems software, I'd be way more confident in any Rust code I wrote than C/C++ code. Nasal demons scare me.

[–] [email protected] 0 points 9 months ago

Do people still think, after all this time and so many different languages, that there will be one language to rule them all? I mean technically you can drive nails with a rock, but you don't see a carpenter using one. Right tool for the job. Always was, always will be.

[–] [email protected] 0 points 9 months ago (1 children)
[–] [email protected] 0 points 9 months ago (2 children)

Leaks aren't usually security critical though, and I've never heard of sudo triggering the OOM killer.

Also, no general purpose language that I'm aware of can guarantee a lack of memory leaks.

[–] [email protected] 0 points 9 months ago

Especially since sudo is generally quite short lived. Unless it is leaking a significant amount of memory waiting for authentication that never comes it is insignificant. It would actually be pretty easy to argue that sudo just shouldn't free memory at all. This would be better for security (all pointers live forever) and possibly faster as upon exec the kernel can just wipe all state rather than having free carefully account for the releases.

[–] [email protected] 0 points 9 months ago

no general purposd language can guarantee a lack of memory leaks

You're going to summon every Rust enthusiast on the platform

[–] [email protected] 2 points 9 months ago (4 children)

Let's rewrite Linux kernel in Python

[–] [email protected] 2 points 9 months ago* (last edited 9 months ago) (1 children)

Fun fact!

The Asahi Linux drivers for the Apple M1 GPU were originally written in Python: https://asahilinux.org/2022/11/tales-of-the-m1-gpu/

GPU drivers in Python?!

Since getting all these structures right is critical for the GPU to work and the firmware to not crash, I needed a way of quickly experimenting with them while I reverse engineered things. Thankfully, the Asahi Linux project already has a tool for this: The m1n1 Python framework! Since I was already writing a GPU tracer for the m1n1 hypervisor and filling out structure definitions in Python, I decided to just flip it on its head and start writing a Python GPU kernel driver, using the same structure definitions. Python is great for this, since it is very easy to iterate with! Even better, it can already talk the basic RTKit protocols and parse crash logs, and I improved the tools for that so I could see exactly what the firmware was doing when it crashes. This is all done by running scripts on a development machine which connects to the M1 machine via USB, so you can easily reboot it every time you want to test something and the test cycle is very fast!

[–] [email protected] 2 points 9 months ago (1 children)

Good for testing and iterating, but what about performance? Though I guess getting everything right is more important right now, translating it into another language will probably require less work that way

[–] [email protected] 2 points 9 months ago

It has already been translated into rust. Python wasn't ever intended to be used in the "real" driver, but I thought it was a fun anecdote none the less.

[–] [email protected] 0 points 9 months ago

Yes and let us build the environment with conda, it's going to be a fun time!

[–] [email protected] 1 points 9 months ago (2 children)

Nobody's built a supercomputer powerful enough to run a python version of even Linux Lite Edition.

[–] [email protected] 1 points 9 months ago (1 children)

I mean, someone made a barebones Linux work in scratch

[–] [email protected] 1 points 9 months ago (2 children)

Like... Kernel written in scratch?

[–] [email protected] 1 points 9 months ago

Yeah, it uses Ed as it's text editor

[–] [email protected] 2 points 9 months ago* (last edited 9 months ago)
[–] [email protected] 2 points 9 months ago

Redstone it is, then.

[–] [email protected] 0 points 9 months ago (1 children)

Just use brainfuck for everything. The entry barrier for the programming industry needs to be higher anyway.

[–] [email protected] 0 points 9 months ago (2 children)
[–] [email protected] 0 points 9 months ago* (last edited 9 months ago) (1 children)

For the programmer? Very no.

For saving space if run via interperter? No.

For running compiled for conventional CPUs? No.

Compared to CISC instruction sets? Absolutely no.

BF might be highly efficient if crunched down to a bit-packed representation (3 bits per instruction) and run on an FPGA that understands it.

[–] [email protected] 0 points 9 months ago

For demonstrating to CS freshmen that Turing Completeness isn't that remarkable of a language feature: very highly efficient.

[–] [email protected] 0 points 9 months ago (1 children)

Can be compressed very efficiently. I do dread the thought of writing a driver in brainfuck.

[–] [email protected] 0 points 9 months ago (1 children)

Why specifically a driver ?

[–] [email protected] 0 points 9 months ago

Hardware is complex and mysterious enough without added complexity of an esoteric language.

[–] [email protected] 0 points 9 months ago (1 children)

C is fun. Thats why I use it :P

[–] [email protected] -1 points 9 months ago

The same way juggling chainsaws is fun I suppose. :)

load more comments
view more: next ›