There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

words_number , in libmem_cpy-strnrrn-std-clib_Cmvaeffc_ld-TWA_nif.aarch64(32bit)2-0.13.2-23.2.so.7(3).1.1.gz.conf

Seriously though, why? Is there historic reasons for that? Did they have to pay extra for more letters back in the day?

scurry ,

Yes. Memory and storage were at a very high premium until the 1990s, and when C was first being developed, it wasn’t uncommon for computers to output to printers (that’s why print() and co are named what they are), so every character was at a premium. In the latter case, you were literally paying in ink and paper by the character. These contributed to this convention that we’re still stuck with today in C.

words_number ,

Thanks for the insight! I think this kind of convention that once made some sense, is now exclusively harmful, but is still followed meticulously, is often called “tradition” and is one of the high speed engines that let humanity drive towards extinction.

scurry ,

I agree, and these conventions are being followed less over time. Since the 1990s, Windows world, Objective-C, and C++ have been migrating away (to mixed results), and even most embedded projects have been too. The main problem is that the standard library is already like that, and one of C’s biggest selling point is that you can still use source written >40 years ago, and interact with that. So just changing that, at that point just use Go or something. I also want to say, shoutout to GNU for being just so obstinate about changing nothing except for what they make evil about style. Gotta be one of my top 5 ‘why can’t you just be good leaders, GNU?’ moments.

words_number ,

at that point just use Go or something

*Rust (obviously!)

QuazarOmega ,

Wait, but they didn’t print out the source code right? Or did they use teletypes to develop?

xchgeaxeax ,

or did they use teletypes to develop

Basically yeah. ed the editor was designed with that in mind

QuazarOmega ,

Oh, that makes a lot of sense then.

After all, it is the standard text editor

spoileruff, doesn’t feel right if it isn’t KasaneTeto saying this :/

zqwzzle ,

IIRC older DOS versions were also limited to 8.3 filenames, so even filenames had a max limit of 8 characters + 3 extension. May it was a limitation of the file system, can’t quite remember.

scurry ,

At one point it was both. At one point they internally added support for longer file names in DOS, and then a later version of the filesystem also started supporting it. I think that on DOS and Windows (iirc even today), they never actually solved it, and paths on Windows and NTFS can only be 256 characters long in total or something (I don’t remember what the exact limit was/is).

isVeryLoud ,

It’s 256, unless you enable something in the registry. NTFS supports paths longer than 256, funnily enough.

NateSwift ,

I’ve heard arguments that back in ye old days each row only had 80 characters and variable names were shortened so you didn’t have to scroll the page back and forth

Knusper ,

I’ve already felt like I should choose shorter names in a (shitty) project where the customer asked us to use an auto-formatter and a max line-width of 120 characters.

Because ultimately, I choose expressive variable names for readability. But an auto-formatter gladly fucks up your readability, breaking your line at some random ass point, unless your line does not need to be broken up.

And so you start negotiating whether you really need certain information in a variable name for the price of badly broken lines.

bleistift2 ,

120 characters is quite much, though.

Knusper ,

Yeah, I meant it as an example, where I was still granted relatively luxurious conditions, but even those already caused me to compromise on variable names.

I’d say, 95% of my lines of code do fit into 120 characters easily. It’s those 5% that pained me.

mustardman , (edited )

I worked with a complier that would assume only compare the first 8 characters and would treat it the same afterwards.

Compiler copyright was around 1990.

Edit: This was for function names in C

SubArcticTundra ,
@SubArcticTundra@lemmy.ml avatar

Damn that must have been such a headache

AngryCommieKender ,

We were limited to a certain number of characters for filenames, way back in the Apple ]|[ days. IIRC it was 8

nothacking ,

They did, with core you could be paying for many dollars per bit of memory. They also often used teletypes, where you would pay in ink and time for every character.

SubArcticTundra ,
@SubArcticTundra@lemmy.ml avatar

Unix didn’t run on core though, did it? I thought core was before its time

nothacking ,

A early models of PDP-11, the computer Unix was developed on, did use core.

bleistift2 , in libmem_cpy-strnrrn-std-clib_Cmvaeffc_ld-TWA_nif.aarch64(32bit)2-0.13.2-23.2.so.7(3).1.1.gz.conf

itoa, atoi

SubArcticTundra ,
@SubArcticTundra@lemmy.ml avatar

_astrnfgets0()

FooBarrington ,

__builtin_PRAGMA_glibc____WIN32___astrnfgets0_musl()

SubArcticTundra ,
@SubArcticTundra@lemmy.ml avatar

__cdecl

db2 , in libmem_cpy-strnrrn-std-clib_Cmvaeffc_ld-TWA_nif.aarch64(32bit)2-0.13.2-23.2.so.7(3).1.1.gz.conf

aarch64(32bit)

🤣

H2207 ,
@H2207@lemmy.world avatar

x86 backwards compatibility

bdesk ,

He was using (a)arch

H2207 ,
@H2207@lemmy.world avatar

Just the 1 premium linux distro please…

Cyberflunk ,

Commodore 64 effective

UrbonMaximus , in The lengths we have to go to

Let me introduce you to YAML, you’ll love it!

dansity ,

I got my hair torn out till I setup my home assistant. I f*cking hate it its stupid

lhamil64 ,

One of these days I’ll actually look up how YAML indentation works. Every time I use it it’s trial and error until I stop getting errors.

merc ,

That’s a super risky way to do it. It might stop giving you errors because you finally got the indentation right, or it might stop giving you errors because you got the indentation “right” but not how you you meant to organize the objects.

CoderKat ,

Ugh, there’s some parts of YAML I love, but ultimately it’s a terrible format. It’s just too easy to confuse people. At least it has comments though. It’s so dumb that JSON doesn’t officially have comments. I’ve often parsed “JSON” as YAML entirely for comments, without using a single other YAML feature.

YAML also supports not quoting your strings. Seems great at first, but it gets weird of you want a string that looks like a different type. IIRC, there’s even a major version difference in the handling of this case! I can’t remember the details, but I once had a bug happen because of this.

Performance wise, both YAML and JSON suck. They’re fine for a config file that you just read on startup, but if you’re doing a ton of processing, it will quickly show the performance hit. Binary formats work far better (for a generic one, protobuffers has good tooling and library support while being blazing fast).

vrighter ,

json 5 does support comments. alternatively, yaml is a superset of json. any valid json is also valid yaml. but yaml also supports comments. So you can also write json with comments, and use a yaml parser on it, instead of a standard json parser

sonnenzeit ,

It’s so dumb that JSON doesn’t officially have comments.

So much this.

Used to work at a company where I sometimes had to manually edit the configuration of devices which were written and read in JSON. Super inconvenient if you have to document all changes externally. As a “hack” I would sometimes add extra objects to store strings (the comments). But that’s super dicey as you don’t know if it somehow breaks the parsing. You’re also not guaranteed the order of objects so if the configuration gets read, edited and rewritten your comment might no longer be above/below the change you made.

Always found it baffling that such a basic feature is missing from a spec that is supposed to cover a broad range of use cases.

bacondragonoverlord , in Zero to Hero in 1 hour

Aka Thighslitting nutcracker.

Rozauhtuno , in I'll just sort it myself
@Rozauhtuno@lemmy.blahaj.zone avatar

JavaScript was made in 2 days through a drunken stupor, and it shows.

csolisr ,

It’s sad to have the rushed ramblings of a bigot become the fundamental block of the modern world wide web. Why couldn’t it be at least made by a more competent bigot like Carmack?

Squirrel , in I'll just sort it myself
@Squirrel@thelemmy.club avatar

Because everyone means “alphabetize” when sorting numbers.

dingleberry , in Zero to Hero in 1 hour

The anklesnappers.

embit , in The lengths we have to go to

He could wrap a rubber band around the screen

MajorHavoc ,

Spoken like a fellow professional Python programmer.

ShittyRedditWasBetter , in Zero to Hero in 1 hour

K8s basics isn’t that hard, but it builds on quite a bit of knowledge. And running anything of complexity to multiple nodes is going to take at least some intermediate tuning to get your app stable.

This is fantastic though.

some_guy , in The lengths we have to go to

I started with Perl. This taught me a certain mindset that works well with Bash and Ruby. I’ve tried to learn Python several times and I just fucking hate it. I gave up when I realized that it just doesn’t work the way that my brain works.

I wonder if the outcome would have been different if I’d started with Python? How might that have shaped my thinking / reasoning? Fwiw, I was also ok with PHP and SQL, but I don’t know much or anything about the backgrounds on those foundations. Maybe my above statements were completely bullshit.

magic_lobster_party ,

I kind of started with Python, and I hate Perl. Relying so much on global variables like $_, @_, $1, $2 is just the worst idea ever. Oh you want to call a function? Better be safe and backup all global variables you’re using, because they will be overwritten! Want to use some regex in a function? Better ensure all callers have made backups of the $1, $2, $3 variables.

The end result is just large amounts of defensive boilerplate everywhere because things will break if you don’t.

There’s also no good way to tell which functions use $_ without looking up the docs or keeping everything in memory.

The only merit Perl got in my opinion is its regex support. Quite handy for bash one liners time from time.

evranch ,

I used to love Perl as it worked the way my brain worked.

Then I started taking medication for ADHD.

I haven’t used Perl since except for text parsing, it’s an absolute hot mess of a language (though very powerful and functional at the things it does well)

some_guy ,

That’s super interesting.

I have a mental divergence that isn’t ADHD. I was reviewing stats on it that said people who have it are some percent more likely to have ADHD. I wonder if my previous enjoyment of Perl is because I’m on an ADHD spectrum. It would be interesting to find out.

thepianistfroggollum , in The lengths we have to go to

And God forbid you use tabs in a document with spaces instead of tabs (or vice versa)

radix ,
@radix@lemm.ee avatar

:retab is your friend!

Armand1 , in I'll just sort it myself

As annoying as this is, you are meant to use a comparer.


<span style="color:#323232;">mapped.sort((a, b) => {
</span><span style="color:#323232;">  if (a.value > b.value) {
</span><span style="color:#323232;">    return 1;
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  if (a.value &lt; b.value) {
</span><span style="color:#323232;">    return -1;
</span><span style="color:#323232;">  }
</span><span style="color:#323232;">  return 0;
</span><span style="color:#323232;">});
</span>
minikieff ,

<span style="color:#323232;">arr.sort((a, b) => a - b);
</span>
SpyingEnvy ,

One hundred percent how I do it everytime.

smik ,
@smik@discuss.tchncs.de avatar

Stuff like that exists to remind us of the Java in JavaScript

pinkdrunkenelephants , in The lengths we have to go to

And that is why I don’t bother with that garbage. C++ for life

gerryflap , in The lengths we have to go to
@gerryflap@feddit.nl avatar

People here are taking this way too seriously lol. I love Python, and I never really had any issues with the indentation being used instead of curly braces or something. This is just a silly meme, not a personal attack

alphacyberranger OP ,
@alphacyberranger@sh.itjust.works avatar

Precisely. It’s like programmers lost their humor.

some_guy ,

Had humor? /s

Asymptote ,

Humor is hard for autists.

(Disclaimer: am autist)

DarkenLM ,

I have not known happiness for 12 years now.

Anticorp ,

Right? Especially since there are plugins for VS Code that colorize the indents.

Asymptote ,

VSCode? Is that an Emacs extension? Or is it for vi?

DarkenLM ,

It's a bash script made to be run on MS-DOS on a breadboard computer.

Asymptote ,

bash

MS-DOS

r u a wizard

DarkenLM ,

I shall henceforth take the title of wizard.

MajorHavoc ,

Sadly neither, but it’s Vi plugin is nearly perfect.

Osnapitsjoey ,

Oooh whats a good one called?

Anticorp ,

I’m not at my computer right now, but I think the one I use is called indent-rainbow.

calzone_gigante ,

I really like the identation aproach, or begin/end instead of curly braces or parenthesis. When people start to nest things too deep, it gets painful to look at.

merc , (edited )

Then you never had to share a codebase with someone who had different ideas about how things should be indented.

gerryflap ,
@gerryflap@feddit.nl avatar

Hmmm nope. That sounds like hell indeed

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines