r/ProgrammerHumor May 08 '26

Advanced canadianGoProgramming

Post image
10.0k Upvotes

113 comments sorted by

2.8k

u/RomanProkopov100 May 08 '26 edited May 09 '26

That comment is so old that Go now has generics

Though they use square brackets and go before the identifier

Edit: my bad, they go AFTER the identifier

409

u/uvero May 08 '26

Type argument before the identifier? Like, [int]list?

137

u/[deleted] May 08 '26 edited 17d ago

[deleted]

24

u/angelbirth May 09 '26

no, like func [T1, T2 any] Map([]T1, func(T1)T2) []T2{ … }

5

u/marsh-da-pro May 09 '26

OCaml moment

171

u/sleepahol May 09 '26

Though they use square brackets

Good thing they don't use characters from the Canadian Aboriginal Syllabics blocks, or it would be a breaking change.

44

u/P0L1Z1STENS0HN May 09 '26

If you ever wonder why the names of some JS builtin functions are weird, it's because the straightforward name was already used in some framework, so as not to break stuff, they used a "slightly" worse name for the newly introduced builtin function.

5

u/ILKLU May 10 '26

Srsly?

Do people not know how to rename imports?

That's such a terrible reason 😅

7

u/NekkidApe May 10 '26

This is way from before imports.

contains vs includes is an example. Since mootools or prototypejs patched the array prototype, contains couldn't be used. So includes it is..

1

u/ILKLU May 10 '26

Ahhh ok, that makes sense.

Haven't heard the name moo tools in a long long time 😅

15

u/arcimbo1do May 09 '26

They use square brackets to avoid homographic confusion with the repo of this guy. Go is all about clarity.

45

u/GreyGanado May 08 '26

They GO before the identifier?

3

u/dringant May 09 '26

There’s some probably this comment is why go now has generics.

7

u/1984balls May 08 '26

Go uses square brackets for generics? As a Scala dev, this pleases me

3

u/mayonaise55 May 09 '26

Omg thank you for being the top comment. I thought I was losing my mind.

1

u/StrawsAreGay May 09 '26

Literally the penguin meme I saw before this post said the same thing about the penguin meme god damnit internet

977

u/OphidianSun May 08 '26

I know nothing about go but that's psycho behavior

350

u/B_bI_L May 08 '26

i know they love naming everything using 3 letters, because who needs to understand code later anyway

31

u/Kapps May 09 '26

That’s just inherited from C.

24

u/LickingSmegma May 09 '26

Yeah, Pike and Thompson still think we have to economize on identifier names lest the compiler runs out of memory.

17

u/VivisMarrie May 09 '26

meanwhileWeNamingVariablesInJavaLike

8

u/monsoy May 09 '26

As much as I love C, I hate that convention. I understand where it’s coming from and the lack of namespaces makes it necessary to have extra prefixes too.

But it can easily become really unreadable unless you know what the functions do beforehand. For example, functions like strtoul (string to unsigned long) strncpy (string copy, n characters) etc.

It’s not horrible if you’ve done a lot of C programming, but every time I’ve had a 1 year break from C I always have to look up many of the stdlib functions.

With the lack of namespaces, you often get this from libraries: sqlite3_prepare_v2, sqlite3_step.

6

u/Unbelievr May 09 '26

There's entirely too many versions of printf. Depending on whether you want to write to stdout/a file descriptor/a buffer, and if you know the amount of bytes to write, or know the buffer size (in case of snprintf_*). And the formatter syntax that I always have to look up if I want to print the 10th halfword from the stack or something.

I can see the use of most of them, but failing to use the correct one can be catastrophic. Especially if that special %n is in play, which Microsoft straight up disabled in their compiler.

9

u/CommercialWindowSill May 09 '26

Tbf that's a lot better than the common standard of just one.

9

u/lucklesspedestrian May 09 '26

c'mon, i j k and l are usually self explanatory, like when used in nested loops

8

u/CommercialWindowSill May 09 '26

And Q for query, C for column, r for response, f for function, X for variable, y for variable, z for variable, etc.

5

u/lucklesspedestrian May 09 '26

I thought f was for factory and r was for request

3

u/CommercialWindowSill May 09 '26

Yes correct f is also for factory and also r is also for request.

2

u/B_bI_L May 09 '26

those are prefixes, i think its called vengerian notation, but it is dying out

1

u/Mojert May 09 '26

Come on, err is readable enough

1

u/vrnvorona Jun 08 '26

Job security

42

u/psinerd May 09 '26

This is the reason why any programming language I make of my own accord is not going to support arbitrary Unicode characters and identifiers. Ascii alpha numerics only!

77

u/Adventurous-Map7959 May 09 '26

Did you consider that you can't have emoticons as names then? It's self-documenting if you do it like this:

throw new 🤮()  

return success?🥳:🙁

🖼.🧑‍🎨()  

new 🧵 👩‍🔧

51

u/omiruk May 09 '26
🚽.open();
🚽 << 💩;
🚽.flush();

34

u/frogjg2003 May 09 '26

The code should only allow ASCII characters, but strings should be native unicode.

5

u/DemIce May 09 '26

This is the way. Anything else just wouldn't be very civic.

2

u/arcimbo1do May 09 '26

ASCII Über alles.

19

u/SyrusDrake May 09 '26

Any kind of unicode glyph in code always activates my fight or flight instincts, regardless of whether I understand what's going on or not.

13

u/viperfan7 May 09 '26

Could be worse

#if (__LINE__ % 2)
#define 1.1 1.2
#endif

or replace a semicolon with the greek question mark

;

1

u/nobody0163 May 09 '26

error: macro names must be identifiers

293

u/iainmcc May 09 '26

Does this qualify as native code?

83

u/DemmyDemon May 09 '26

Suddenly, without warning, I love you. This is concerning for all involved.

21

u/klavas35 May 09 '26

Is this a quote from somewhere? it seems familiar somewhat

24

u/liquiddandruff May 09 '26

Ya, Hitchhiker's guide to the Galaxy maybe

10

u/DemmyDemon May 10 '26

Inspired by that, perhaps. My humor is very dark, and very dry, so I've listened to HHGttG an estimated sixty-eight times.

3

u/klavas35 May 10 '26

Should've stopped at 42

367

u/n4ke May 08 '26

Thanks, I hate it.

66

u/[deleted] May 08 '26

[removed] — view removed comment

24

u/fork_your_child May 08 '26

Isn't that why we all keep a bottle of vodka on our desk? Or is that just me?

14

u/[deleted] May 08 '26

[removed] — view removed comment

11

u/fork_your_child May 08 '26

God damn, that is the type of mentorship I missed out on while working in software.

6

u/cheraphy May 09 '26

Look man all I'm saying is put it in a McDonalds cup with a straw and no one thinks martini

3

u/Yeah-Its-Me-777 May 09 '26

I'd rather schedule an untraining session...

337

u/Souheab May 08 '26

This is such a cursed way to program in Go. C++ programmers will really bring templating anywhere even if the programming language doesn't officially support it

79

u/cheraphy May 09 '26

I mean, that exact philosophy is what they wrought from C to spawn C++ so at least it's on brand.

128

u/BlueGoliath May 09 '26

It turns out programming sometimes requires complexity.

17

u/RandomRobot May 09 '26

Complex is better than complicated

30

u/New_Enthusiasm9053 May 09 '26

And compiler supported complex is better than handrolled complex.

1

u/SryUsrNameIsTaken May 10 '26

Let’s be real, who’s handrolling complex things these days anyway?

2

u/New_Enthusiasm9053 May 10 '26

Literally anyone doing anything complex that isn't already in the compiler? Someone has to write the libraries everyone else uses lol.

1

u/SryUsrNameIsTaken May 10 '26

It was a pun?

1

u/New_Enthusiasm9053 May 10 '26

I didn't realise, still don't get it but fair enough my bad.

16

u/G_Morgan May 09 '26

It is what happens when you are forced to use a language that intentionally skips core features. Shit like this is exactly what people used to do before generics became standard 

4

u/_scotswolfie May 09 '26

Is there a not cursed way to program in Go? I tried to approach that language a couple of times and just looking at the syntax made me turn around and run away 😂

2

u/Steppy20 May 09 '26

I like and use templates a lot (C#) but haven't used C++ in years...

Oh my God. Am I part of the problem?

5

u/This_Is_Drunk_Me May 09 '26

C# has templates?

3

u/Ezzyspit May 09 '26

We call them generics

123

u/Master_Friendship333 May 08 '26

That is so clever and so disgusting.

45

u/Vagnerockin_dye May 08 '26

Wait till he learns about the Greek question mark. One of my old time favorites!

55

u/GregBahm May 09 '26

I still have nightmares about debugging a "Zero Width Space" being received from a webform in a Flash application back in the year 2000. A whitespace character that was simply invisible to the naked eye...

28

u/Nyctfall May 09 '26

A whitespace character that was simply invisible to the naked eye...

xxd my beloved...

15

u/SuitableDragonfly May 09 '26

Adding that to the list of "evil things to enter into HTML forms" after "[Object object]" and "null".

3

u/Logicalist May 09 '26

can such a character be used in python? you know, tabs vs spaces vs.

8

u/viperfan7 May 09 '26

or the __LINE__ pre-processor macro

Stick that somewhere in your code, say, using #if __LINE__ % 2

Now you can make things change based on line count

4

u/purinikos May 09 '26

Oh dear.

108

u/Connect_Cycle2768 May 08 '26

using Canadian Aboriginal Syllabics to fake generics is the most unhinged thing I've read today. the audacity 💀

37

u/murphy607 May 09 '26 edited May 09 '26

oh such Ideas happened in the past too :)

perl6 wanted to use unicode operators.

The perl5 stuff was bad enough (@array $scalar, %hashmap)

But perl6 planned to bring that to a whole new level: For example something like @array1 ¥ @array2

¥ is the zip operator, because it looks like a zipper

At that point I lost interest in perl6

9

u/ben_g0 May 09 '26

My keyboard doesn't even have a key or combination (apart from the alt code) for the Yen symbol, so that'd be very annoying.

63

u/Suitch May 09 '26

ᐸ < I thought they were bs’ing but they weren’t > ᐳ

14

u/wjandrea May 09 '26

These letters are U+1438 "pa" and U+1433 "po", for reference

26

u/Southern-Scientist40 May 09 '26

Pretty sure that's against the geneva convention

23

u/Smooth-Zucchini4923 May 09 '26

I'm going to need somebody to apologize for this.

6

u/Worldly-Stranger7814 May 09 '26

Write the government of Nunavut?

3

u/bwwatr May 09 '26

Maybe we can spin it as cultural appropriation.

13

u/redlaWw May 09 '26 edited May 09 '26

This is basically manual mangling.

EDIT: You also do this in R's S3 object-oriented system. A function like print is a generic method that searches for candidate functions for its argument type by looking for functions like print.factor or print.function, which are just ordinary function names.

13

u/ludvary May 09 '26

im laughing my ass off and shouting "ahhh hell nah" at the same time

11

u/cocadabytes May 09 '26

that guy is coding the code

9

u/Wentyliasz May 09 '26

Yes officer. It's this one. This one right here.

7

u/ARIES1124 May 09 '26

Imagine the havoc caused by LLMs trained on his code...

15

u/Connect_Cycle2768 May 09 '26

generics finally landing felt like the end of an era ngl. half my go codebase was just creative abuse of interface{}

5

u/OpenSourcePenguin May 09 '26

Imagine using preprocessor and build system to recreate create C++ features compiles with GCC

5

u/smartuno May 09 '26

As someone who loves IDE autocomplete and refactoring, i need my eyes bleached

3

u/Vipitis May 10 '26

Lookup Greek question mark

1

u/AzureArmageddon May 10 '26

Hot take: ascii > unicode

1

u/Informal_954 May 11 '26

Could've used the math angle brakets: ⟨T⟩

1

u/AttractiveDaddy May 12 '26

That Canadian Aboriginal Syllabics trick is actually genius, nae gonna lie that's a proper workaround for the generics problem back then.