HACKER Q&A
📣 behnamoh

Is there any programming language that doesn't have WTFs?


After reading this page:

https://github.com/satwikkansal/wtfpython?tab=readme-ov-file#-needles-in-a-haystack-

I wonder if there's any language that thought about all edge cases and avoided exceptions and such gotchas at the design level.

JS is notorious for such WTFs but even Python—which I've used for over a decade now—has surprised me countless times.

Is Haskell also like that? How about Lisps (CL, Racket, Clojure, Scheme, etc.)?


  👤 tromp Accepted Answer ✓
Haskell is relatively WTF free as a language, behaving pretty much like the lambda calculus, but the standard libraries have their share of WTFs, such as the Enum instance for Double:

ghci> [0, 0.3 .. 2.0] [0.0,0.3,0.6,0.8999999999999999,1.2,1.5,1.7999999999999998,2.1]

I'd rather not see 2.1 in a range up to 2.0


👤 PaulHoule
Only highly abstract languages like Brainfuck

https://esolangs.org/wiki/Brainfuck

which are too simple to have WTFs, although you might say the whole thing is a WTF. I think AVR-8 assembler is WTF free, but I'd like a more powerful macro assembler which would probably introduce a WTF.

Common Lisp is full of WTFs, I went through many stages of grief reading Graham's On Lisp but most notable was "if he was using Clojure he wouldn't be fighting with nconc". People have problems with Clojure too

https://www.more-magic.net/posts/thoughts-on-clojure.html


👤 Gibbon1
For #3 on that list C has that too. And I often use it.

   printf( "thing1=%u\n"
           "thing2=%u\n"
           "thing3=%u\n"
           "thing4=%u\n"
           "thing5=%u\n",
       thing1,
       thing2,
       thing3,
       thing4,
       thing5);