Skip to content
DevMeme
5860 of 7590
Languages Post #6418 · source on Telegram

Faking Go generics with Unicode, and watching compiler sanity unravel

Description

Meme split in two halves: top is a Reddit thread screenshot titled "Parallelizing Enjarify in Go and Rust" with a highlighted comment asking, “can you please explain this go syntax to me? type ImmutableTreeList<ElementT> struct { I thought go doesn’t have generics.” The reply explains that Go lacks generics, the angle-bracket look-alikes are actually Canadian Aboriginal Syllabics Unicode characters, and a search-and-replace template later monomorphizes three concrete files. Bottom panel shows a blurry, taxidermy-looking bird with teal head and caption "Every day. We stray further from god." in white text. The humor lands for seasoned engineers who remember pre-1.18 Go hacks: abusing permissive identifier rules, generating code instead of proper generics, and the inevitable readability debt such tricks incur. Visual colors are standard Reddit whites and yellows, with the lower image dark and slightly pixelated, emphasizing existential dread at this kind of code ‘creativity’

Comments

10
Anonymous ★ Top Pick Nothing like sneaking entire Unicode planes past the parser - because who needs type parameters when your identifier can contain its own character set?
  1. Anonymous ★ Top Pick

    Nothing like sneaking entire Unicode planes past the parser - because who needs type parameters when your identifier can contain its own character set?

  2. Anonymous

    This is what happens when you've been writing Go for so long that you start seeing Canadian Aboriginal Syllabics as a perfectly reasonable solution to the lack of generics - next thing you know, you'll be implementing inheritance using emoji and wondering why your PR got rejected with just a crying face reaction

  3. Anonymous

    Ah yes, the classic pre-Go-1.18 era: when developers were so desperate for generics they resorted to Unicode character exploitation and template files. Using Canadian Aboriginal Syllabics as angle brackets is the kind of 'technically correct' solution that makes you simultaneously admire the ingenuity and question every life choice that led to this moment. It's the programming equivalent of discovering your colleague has been using reflection and code generation to simulate features the language intentionally doesn't support - brilliant, horrifying, and absolutely unmaintainable. At least now with actual generics in Go, we can look back at these archaeological artifacts and appreciate how far we've come from the dark ages of `interface{}` everywhere and Unicode character shenanigans

  4. Anonymous

    Pre - Go-1.18 ‘generics’ delivered via Unicode and sed - compilers cope, but grep, linters, and future-you file the postmortem

  5. Anonymous

    Go's fix for generics: weld them into one unpronounceable identifier. Maintainability? That's your problem now

  6. Anonymous

    Pre‑1.18 Go: want generics? Use Unicode confusables and a sed pipeline - one identifier to the compiler, one resignation letter to the on‑call

  7. @azizhakberdiev 1y

    Could be worse

  8. @azizhakberdiev 1y

    Oh wait, no it couldn't

  9. @evankh 1y

    Build your own C preprocessor with Ctrl+F and Ctrl+V

  10. @C3R741NLY_1MPR3S51V3 1y

    Language: py Code: # mom can we have Java # No. We have Java at home # Java at home: newㅤHashMapᐸStringᐳ=lambda *int:{*int} HashMapᐸStringᐳㅤmap = newㅤHashMapᐸStringᐳ(7,8,9); print(HashMapᐸStringᐳㅤmap); Output: {8, 9, 7}

Use J and K for navigation