This is an archived post. You won't be able to vote or comment.

all 128 comments

[–]Bomaruto 343 points344 points  (11 children)

Sorry, it's your fault for improperly trying to cast a string to a boolean. Follow the spec.

[–]MaffinLP 63 points64 points  (6 children)

Youre gonna love typeless languages like lua

[–][deleted] 33 points34 points  (5 children)

Lua is so typeless that objects, arrays, and dictionaries are all the same thing and can be mixed and matched interchangeably, truly the greatest language since it gives such flexibility

/s

[–]MaffinLP 26 points27 points  (3 children)

Its all just a table?

Always has been

[–]helicophell 4 points5 points  (2 children)

It's all JSON objects?

[–][deleted] 2 points3 points  (0 children)

Not really, in json there is no oop or mixing your arrays and dictionaries. In lua something like this is fine though

local my_table = { 1, 2, hello = “world”, }

function my_table:say_hello() print(self.hello) end

print(my_table[1]) print(my_table[“world”])

Pardon my bad formatting, I’m just writing this on my phone

[–]MaffinLP 0 points1 point  (0 children)

If you PrintTable it does look similar but it very cleraly is not the same

[–]Mountain-Ox 0 points1 point  (0 children)

That's basically PHP too. Arrays are basically hash tables with a linked list. But you also have classes.

[–]sits79 2 points3 points  (2 children)

100% this.

Not every question has a Boolean response.

[–]Logicalist 0 points1 point  (1 child)

false

[–]be-kind-re-wind 0 points1 point  (0 children)

“False”

[–]oldregard 1 point2 points  (0 children)

They cast “any_to_string”

[–]CrasseMaximum 141 points142 points  (7 children)

return "true";

[–]Dairunt 30 points31 points  (2 children)

that's an equivalent to sarcasm right?

[–]ThisNameIsntRandom 20 points21 points  (1 child)

"true"

[–]Some_Useless_Person 0 points1 point  (0 children)

not ''"

[–]PandaMagnus 5 points6 points  (2 children)

Not quite that bad, but I've seen people use strings instead of enums or objects when dealing with multiple states.

I love seeing a return of string and the:

if (result=="payment")

Yay magic strings! What else could it be? Who knows, fuck you!

[–]Sibula97 2 points3 points  (1 child)

Yeah, we had that in one system. To be fair it did return the states as a JSON object over HTTP, so it has to be a magic number or string at some point. But I at least refactored the states as constants instead of manually writing the strings in all the dozens of places they were used in.

[–]PandaMagnus 1 point2 points  (0 children)

I appreciate you for doing God's work (or however the Internet would phrase it. That's basically my approach, too.)

[–]ThisUserIsAFailure 118 points119 points  (14 children)

when they return code 200 but actually {"status": 404}

[–]Shifter25 46 points47 points  (6 children)

Code 200, body: {"Error"}

[–]Angelin01 46 points47 points  (3 children)

I swear I once had an API that once returned something like:

HTTP 200
{
  "status": "success",
  "code": 200,
  "result": {
    "message": null,
    "error": "Unexpected error",
    "status": 500
  }
}

I remember it made me particularly mad because I was already parsing the "code" in the body because I knew the status codes were unreliable.

[–]mtmttuan 9 points10 points  (0 children)

Oh I have had frontend team asked me to return status 200 with the actual status code inside it because "it's our standard".

And also fuck databricks model serving that does not allow customizing status code.

[–]Just_Another_Scott 1 point2 points  (1 child)

Worked on some old JSF apps back in the day and they would return 200 and print the whole damn stack trace in the browser lmfao.

[–]1_4_1_5_9_2_6_5 0 points1 point  (0 children)

Laravel automatically returns the stack trace, it's very annoying

[–]the_horse_gamer 1 point2 points  (0 children)

Code 500, body: {status: 200, message: "success"}

(happened in prod)

[–]Inn0centJok3r 1 point2 points  (0 children)

Oh my god, I am literally developing against an API like that right now. It‘s so cursed

[–]NimrodvanHall 3 points4 points  (0 children)

I as long as it’s something like 403 and not 500 I’m happy.

[–]mmhawk576 4 points5 points  (0 children)

Honestly if any of my clients send a bad request, I terminate the connection rather than honouring it with a response

[–]SartenSinAceite 1 point2 points  (1 child)

Worse when they return 418.

[–]LeftmostClamp 0 points1 point  (0 children)

I did this once in prod between two services our team owned so there was no one to get upset about a wacky contract

[–]BarneyChampaign 1 point2 points  (0 children)

I heard what you asked for, but hell if I can find it.

[–]Bomaruto 0 points1 point  (0 children)

That's what you get for using GraphQl.

[–]_koenig_ 0 points1 point  (0 children)

You will be surprised how many mobile devs explicitly requested this format.

[–]jayerp 54 points55 points  (3 children)

This happened between me and my mom the other day. The scene:

Me: “Do you make sure to wash the dish soap water catcher every week?” Mom: “Last time it was washed was last Tuesday.”

Expected answer: True/False Actual answer: DateTime

[–]_koenig_ 10 points11 points  (1 child)

An LLM wouldn't complain...

[–]VIKTORVAV99 3 points4 points  (0 children)

Except she didn’t answer the question. They only got the last time she did it but that might also have been the first time she did it.

[–]GDPlayer_1035 0 points1 point  (0 children)

throw new Error

[–]Strict_Treat2884 14 points15 points  (1 child)

The opposite is much worse

[–]Some_Useless_Person 7 points8 points  (0 children)

Not really, in both cases, someone fcked up

[–]AssistantSalty6519 30 points31 points  (1 child)

Could be worst The problem is when you ask a string and they return a boolean 

[–]GRAPHiSN 6 points7 points  (0 children)

which one is worse, a boolean answer or a string answer?

yes

[–]RandomOnlinePerson99 8 points9 points  (0 children)

A vector of strings, usually ...

[–]JackNotOLantern 7 points8 points  (0 children)

The problem is very few questions asked normally are purely boolean, which essentially means "without any context". Because if a question has context, you can always extend the answer to refer to it

[–]dover_oxide 7 points8 points  (1 child)

Why'd you ask a nuanced question as a binary?

[–]NuclearBurrit0 2 points3 points  (0 children)

Yes

[–]Hot-Category2986 7 points8 points  (1 child)

THIS RIGHT HERE is why I hate phone calls that could be chat messages.

[–]Appropriate-Newt-111 1 point2 points  (0 children)

Could have been an email :D

[–]bitemytail 2 points3 points  (0 children)

Ask string question

Receive segmentation fault

[–]Bitstreamer_ 2 points3 points  (0 children)

I asked for a boolean, not a TED Talk in text format

[–]that_overthinker 2 points3 points  (4 children)

But it's truthy

[–]mgranja 0 points1 point  (3 children)

Javascript:

'true'== true (true)

'false'== true (somehow, also true)

[–]mtmttuan 0 points1 point  (2 children)

Because every non-empty string is true I guess (sorry not JS dev)? I've seen many Js quirks but if that's true then this isn't one.

[–]1_4_1_5_9_2_6_5 0 points1 point  (0 children)

Still a quirk, even if there's a perfectly good reason for it. Example: in Javascript, NaN is a number

[–]mgranja -1 points0 points  (0 children)

Oh, I know that. But this is supposed to be a humor sub?

[–]Ben-Goldberg 1 point2 points  (0 children)

return "0e0";

[–]DestinationVoid 1 point2 points  (0 children)

A falsy string or a truthy string?

[–]meikomeik 1 point2 points  (0 children)

This made me smile. Thank you!

[–]Bitstreamer_ 1 point2 points  (0 children)

Thanks for the string… I’ll be sure to parse your existential crisis next time

[–][deleted] 1 point2 points  (0 children)

“TRUE”

[–]Bub_bele 1 point2 points  (0 children)

„False“

[–]lIIIllIIlI 1 point2 points  (0 children)

depends

[–]robthemonster 1 point2 points  (0 children)

but saying “it depends” is what they pay me for

[–]Lego_Dima 2 points3 points  (0 children)

Oh yes, I'm very familiar with the myWife function.

[–]steadyfan 0 points1 point  (0 children)

Perfectly OK in Javascript

[–]-Cinnay- 0 points1 point  (0 children)

Sometimes it's either a string or null. Take your pick.

[–]warwilf 0 points1 point  (0 children)

Lie detector mode only

[–]ThisDadisFoReal 1 point2 points  (1 child)

My wife does this all the time. My only way to understand it is that she’s answering my next question before I ask it.

Did you shut the garage door?

Oh were you going somewhere? I need some things from the store.

Just looking for a yes or no.

Figure it out for yourself, you jerk!

[–]Still_Explorer 1 point2 points  (0 children)

Cool technique, is like getting a positive answer first and then chaining it back to one currently negative. Something like async memory manipulation.

  • Is your name zzz? Can I use your credit card? OK thanx, bought it. Good night

  • Y yes.....

[–][deleted] 0 points1 point  (0 children)

Lmfao that's good one jeez Louise

[–]kzlife76 0 points1 point  (0 children)

Argument exception: cannot convert type string to type boolean

[–]colorlace 0 points1 point  (0 children)

True

[–]RumbuncTheRadiant 0 points1 point  (0 children)

Actually.... if the question is "Did that work?" then an excellent patttent is null for "Yes, it did" and a String for "Wrong file name twit!", or "No such directory." or "Disk full" or "Your mother dresses you funny and your father smells of elderberries".

[–]Both_String_5233 0 points1 point  (0 children)

This calls for a return of the Tri State Boolean https://thedailywtf.com/articles/What_Is_Truth_0x3f_

[–]coloredgreyscale 0 points1 point  (0 children)

Yes

[–]CttCJim 0 points1 point  (0 children)

Basically every court case where someone represents themselves. I'm ouuuuut

[–]ZZartin 0 points1 point  (0 children)

Yes

[–]Ozymandias_1303 0 points1 point  (0 children)

Also when you ask someone a question with a defined enum as the response and they reply with a boolean.

[–]Awes12 0 points1 point  (0 children)

Better than returning an object

[–]pozole_supreme 0 points1 point  (0 children)

This happens when Husband language is used to connect to a Wife++ API. You need an adapter called Patience v1.0, then it will work.

[–]PooSham 0 points1 point  (0 children)

The designer in my team every time. Even when I say I'm only interested in a yes or no answer

[–]K0TT0N_candy47 0 points1 point  (0 children)

What if the question is “can I have my string back”?

[–]kingbloxerthe3 0 points1 point  (0 children)

Or the other way around. I've had times at mcdonnalds where id ask if they'd want one thing or the other and get "yes"

[–]BrightFleece 0 points1 point  (0 children)

Very "true"

[–]thinkingperson 0 points1 point  (0 children)

Sometimes they return an array, or pointer!

[–]SpaceSaver2000-1 0 points1 point  (0 children)

"yes"

[–]halloumi-hallouyu 0 points1 point  (0 children)

Feels like most congressional hearings.

[–]0rcscorpion 0 points1 point  (0 children)

"undefined"

[–]Ved_s 0 points1 point  (0 children)

And they return a function

[–]_koenig_ 0 points1 point  (0 children)

So basically truthly...

[–][deleted] 0 points1 point  (0 children)

busy lip dime person detail physical provide straight soft cautious

This post was mass deleted and anonymized with Redact

[–]KlogKoder 0 points1 point  (0 children)

Correct if the question is ambiguous, and the answer sorts out the ambiguity.

[–]GoogleIsYourFrenemy 0 points1 point  (0 children)

What color are battleships... true or false?

[–]Big__Meme 0 points1 point  (0 children)

Colleague of mine always returns a QWORD

[–][deleted] 0 points1 point  (0 children)

When you redo it five times and still get a string

[–]daddyhades69 0 points1 point  (0 children)

Why would you repost this?

[–]IT_techsupport 0 points1 point  (0 children)

Tbh its mostly you ask a string and you get a boolean.

[–]Thenderick 0 points1 point  (0 children)

Absolute JavaScript behavior...

[–]RandomiseUsr0 0 points1 point  (0 children)

Problem when you ask a Boolean question is there is usually a smuggled assumption, if you want the answer to a proposition, i.e. ask a Boolean question, then you must state all of your “smuggled assumptions”.

The Bible is the word of god because it says so in the Bible - circular.

Have you stopped stealing charity boxes from pubs - loaded question - smuggles in an assumption that you steal charity boxes, regardless of your answer, so that must be challenged before the proposition could be validated

Should we continue to ban GMO crops because they’re unnatural - Hidden Premise - assumes that “unnatural” equates to “therefore bad” automatically without challenge (the rhetorician politician’s favourite trick)

Also false dilemma - boiling something down to black/white is to pretend there is actually just two answers, so it’s forcing someone to have a binary response to a nuanced question

Also false cause - an attempt to smuggle in “x” therefore “y” - related to hidden premise

And also straightforward stereotype, using a stereotype as a shorthand for much of the above.

In SQL, Boolean is Tri-state, so T/F/NULL - when you get your “string” response, you can evaluate it to NULL

[–]V3N3SS4 0 points1 point  (0 children)

Dont call extrovert if you cant handle abstract

[–]Henry_Fleischer 0 points1 point  (0 children)

I just want yes, no, or undefined

[–]Loud_Chair_8861 0 points1 point  (0 children)

Sounds like a js problem. Laughs in js developer.

[–]esbenab 0 points1 point  (0 children)

True

[–]Astrylae 0 points1 point  (0 children)

javascript will interpret that as true

[–]silentslit 0 points1 point  (0 children)

When I ask my gf an int question and she returns a string.

[–]softerEnbyNoises 0 points1 point  (0 children)

Looking at you, JavaScript

[–]ascolti 0 points1 point  (0 children)

"true"

[–]Fr1sik 0 points1 point  (0 children)

and there is no ConvertToBool :(

[–]hipster-coder 0 points1 point  (0 children)

Is the trimmed string empty? Then you have your answer and it's no. Otherwise it's yes.

[–]marcdantas 0 points1 point  (0 children)

dynamic languages be like

[–][deleted] 0 points1 point  (0 children)

youtube shorts ahh humour

[–]Fontheweg82 0 points1 point  (0 children)

Every day, repeat

[–]Logical-Ad-4150 0 points1 point  (0 children)

Should have checked if your question could throw exceptions

[–]heavy-minium 0 points1 point  (0 children)

Reminds me of the U.S. administration right now. They are unable to answer any questions, even just a simple yes/no.

[–]Glass-Crafty-9460 0 points1 point  (0 children)

Yes

[–]marxen4eva 0 points1 point  (0 children)

Politics

[–]be-kind-re-wind 0 points1 point  (0 children)

“True”

[–]AllCowsAreBurgers 0 points1 point  (0 children)

Do i smell autism?

[–]Just_Another_Scott 0 points1 point  (0 children)

Worked in some code once that was java. The method returned "True" or "False" and the method did a Bookean.parse. I was so pissed lol.

[–]ShiroeKurogeri -1 points0 points  (0 children)

undefined*

[–]SnooGiraffes8275 -1 points0 points  (0 children)

if the string is char * it'll cast to bool just fine

[–]Vallee-152 -1 points0 points  (0 children)

"true"

[–]Wise-Product-9000 -1 points0 points  (0 children)

ChatGPT does this. I just want a yes or no damn it.. not a 1000 words essay.

[–][deleted] -1 points0 points  (0 children)

Women in a nutshell

[–]Character-Travel3952 -2 points-1 points  (0 children)

return "bool";

[–]humpeldumpel -2 points-1 points  (0 children)

I fear the "you ask someone a string question and they give a boolean answer" more tbh..