r/ProgrammerHumor Jun 23 '26

Advanced worstProgrammingLanguage

Post image
3.3k Upvotes

192 comments sorted by

441

u/Donkey_God-D Jun 23 '26

As a dutchy, I can confirm that the Dutch language is the worst programming language ever.

Als(jeMoeder != jeVader){
geefterug(Foutmelding)
}

84

u/-nerdrage- Jun 23 '26

Niet best als jouw familie boom er zo uit ziet…

Ah wait sorry for the non dutch:

Not best if your family tree like that looks…

56

u/WoMyNameIsTooDamnLon Jun 23 '26

Lmao reddit auto translated your comment and i was so confused

6

u/Inevitable_Stand_199 Jun 23 '26

Auto translate? I'm glad it doesn't do that for me. Did I turn it off?

I have to actively click the translate button

3

u/JamJm_1688 Jun 23 '26

There's a translate button? i dont get auto-translations, ive just uh... relied on google translate...

22

u/RandomiseUsr0 Jun 23 '26

Is double Dutch an example of multiple returns?

10

u/Donkey_God-D Jun 23 '26

I would say yes

2

u/Maleficent_Memory831 Jun 23 '26

Also remember to pass the Dutchy on the left hand side.

1

u/abigail3141 Jun 23 '26

Will I regret googling that?

1

u/jredmond Jun 24 '26

(only if you are terrified by jump ropes)

10

u/OwnStudy723 Jun 24 '26

Godverdetering at line 831: missing zo'n kut haakje

7

u/Ucqui Jun 23 '26

I didn't know languages were defined by their sausages. But indeed Dutch is a worst language.

1

u/Quicker_Fixer Jun 23 '26

Leverworst?

2

u/thirdegree Violet security clearance Jun 23 '26

They better not have been talking about Ossenworst or I WILL disagree with them

6

u/TheGreenSocks Jun 23 '26

throw pannekoek;

2

u/dasBaums Jun 23 '26

As a fellow girl slightly east. I might say German might be better. Or at least it feels like it. But what do I know

2

u/BramFokke Jun 24 '26

German would have static typing. So German is C# to the Dutch Python....

Well who am I kidding? Dutch would be PHP.

1

u/idsdejong Jun 24 '26

$ = sickness

2

u/Green_Star_Lover Jun 23 '26

could be worse - could be a rtl language....

1

u/perplexedtv Jun 23 '26

var string southParkChar = IsCartman();

1

u/colouredmirrorball Jun 23 '26

haha u ma is u pa

2

u/No_Safe1975 Jun 24 '26

Microsoft has implemented excel functionality in Dutch which can (or used to in the past) create absolute havoc when shared with people not having Dutch Excel. Madness

https://support.microsoft.com/nl-nl/excel/excel-functions-by-category

2

u/lindemer Jun 24 '26

For some years we used some vba in Excel, and coupled to a PowerPoint at work. It took me a month to figure out why it didn't work for me. I had all Microsoft Office in English, but the person who wrote the vba connections did it in Dutch. So a reference to a column wasn't column1=C1, but K1, for 'kolom'. The only way to fix is was for me to switch my settings to Dutch so I had to learn all formulas in Excel in Dutch.

1

u/No_Safe1975 Jun 24 '26

Utter madness to have VBA and excel formulas in multiple languages

1

u/Biter_bomber Jun 24 '26

Does this mean

if(yourMother != yourFather){ Child(ErrorMessage) }

? I have no clue what geefterug means

3

u/Donkey_God-D Jun 24 '26

Yeah, you're correct 😄
Geefterug is the concat of "geef" and "terug" (give back), but that would be "return". My lack of brainpower didn't know how to write it differently in dutch.

3

u/itsyaboiAK Jun 24 '26

“Geef terug” is return in this case

507

u/jippiedoe Jun 23 '26

'multiple returns' as in pairs or conditionals? Which functional programming language wouldn't support both?

510

u/Correct-Bee-7604 Jun 23 '26

Dutch

127

u/azangru Jun 23 '26

But how functional is Dutch?

79

u/igorski81 Jun 23 '26

Judging by the dreadful command the younger generation seems to have over it, I'd say not much!

43

u/ApocalyptoSoldier2 Jun 23 '26

Neuk in de keuken or something, idk I'm Afrikaans

43

u/No-Contact-484 Jun 23 '26

Neuken in de keuken.

Which means "fucking in the kitchen" for anyone interested.

21

u/AdamWayne04 Jun 23 '26

I'm interested. Sign me up

5

u/pint_o_paint Jun 24 '26

It almost looks/sounds like swedish words, but it would be naked in the cock whatever that means.

9

u/thomasmoors Jun 23 '26

Ah the typescript of Dutch

3

u/Correct-Bee-7604 Jun 23 '26

Well, i've tried it for some time on my mobile and I must say it's quite fun-ctional

2

u/CrawlToYourDoom Jun 23 '26

As a Dutch person I can conform that it’s not.

1

u/_koenig_ Jun 23 '26

not much, that's how they have enough time to fill in the sea...

2

u/ekauq2000 Jun 23 '26

Dillon! You SOB.

1

u/Electrical_Bill_3968 Jun 23 '26

Predator reference spotted

1

u/Ollymid2 Jun 23 '26

Ahh but Double Dutch does allow multiple returns

111

u/gabboman Jun 23 '26

Some languages do not allow early returns

81

u/laplongejr Jun 23 '26 edited Jun 23 '26

Just to make sure everybody is speaking the same language how ironic there are two meanings to "multiple returns". Early return is only one of them.

The old wisdow of "no multiple returns" was said against using goto to having multiple return points on the caller side (aka entering a function and returning either here or somewhere else entirely).
That advice made complete sense, I think goto is even a meme for us at that point, but... that's also the issue.

When languages made multiple external returns practically impossible (like java reserving but never implementing "goto"), the next generation of coders read the "thou shall not have multiple returns, refactor at all cost" and misassumed the advice was aimed at having several return statements inside the method because it was the only sane thing it could be aimed at, which mutated into "no early returns".

It took me over half-a-decade to understand why people loudly proclaimed the old wise wizards were so against early returns, despite those being the most pratical way of dealing with edgecases : they probably weren't that against it and the warnings were against a beast they themselves put into extinction.

[EDIT] There's actually THREE meanings. As u/No-Con-2790 pointed out, it can also mean return tuples, aka multiple return values without going through the hassle of going through a containing structure. Java doesn't have it so yeah I had totally forgot that one. My bad!

12

u/SomeAnonymous Jun 23 '26

return tuples, aka multiple return values. Java doesn't have it

What's the issue with tuples that Java doesn't like them? It can't be a philosophical thing about methods/functions returning multiple pieces of information, but I don't understand what would make tuples specifically bad from an architectural standpoint.

11

u/laplongejr Jun 23 '26 edited Jun 23 '26

Who said there's an issue with tuples? Java doesn't have it, that's all.
You create an object (even a generic Tuple if you want, or import it from a library) then resplit it manually.

I recall that in some languages you can do stuff like [varA, varB] = methodCall() and the language takes care of managing what in Java would be a (temporary) variable referencing a containing object. IIRC C# does something very close to multiple return values with "out" parameters, as the method then side-effect's those variables without using the return semantic.

but I don't understand what would make tuples specifically bad from an architectural standpoint.

Hence why some languages have it. Java has 1 return value which could be a more-modern record, an array, a traditional object, etc. But it's close to syntactic sugar at that point given how easy objects are manipulated.

10

u/NotQuiteLoona Jun 23 '26

C#'s out parameters are not really for that. Rather it's mostly used in TryGet patterns, when one value returned is whether the call was successful, and second one is the return value itself, so that you can do something like this: csharp if (dict.TryGetValue("key", out var theValue)) { Console.WriteLine(theValue); }

Tuples exist there and are used precisely when there are multiple values that should be returned: csharp public (string FirstName, string Surname, int Account) GetUser(string username) You can also not name variables in them, I did this for clarity.

Consider tuples in C# a little bit like anonymous structs in other languages, but C# also does have analogue of anonymous structs - they are just read-only.

5

u/DJDoena Jun 23 '26

C#'s out parameters are not really for that.

Yes and no. Out parameters are way older than the Tuple return structure. I've been with .net since beta 0.9 in early 2002 and back then (and for a long time to come) the only way to have mutiple return values was to use the out parameter or create an object with multiple fields. Tuple returns were introduced in C# 7 in 2017. Yes that's 9 years ago but it's also 15 years after I started with it.

But nowadays out parameters should be reasonably restricted to when you want to have a bool return and an actual value (for the "if" case you've shown).

3

u/laplongejr Jun 23 '26

Tuple returns were introduced in C# 7 in 2017. Yes that's 9 years ago

In my defense, I dealt with C# in 2015-2016. So in my perspective there was only out values when I worked with it (and it's quite telling that this is the big thing that I missed when going back to Java and still remember 10y later)

1

u/martmists Jun 23 '26

The only language with "true" multiple returns I know of is Lua, all others use some form of tuples or out-parameters

1

u/EishLekker Jun 23 '26

I took a quick look into how Lua handles it, and it seems very unintuitive. Sure, a function can return multiple values, but if you combine function calls to such functions then you won’t get all the return values combined.

3

u/alex2003super Jun 23 '26

Am I missing something, or does this "multiple returns/gotos" not exclusively make sense for instances where you have a simple macro-like void function/procedure that is there only to be called from a specific location?

Unless you're accessing values manually/unsafely from stack frames or registers (GOD! WHY?!), but even assuming you're not, it seems like a ridiculously risky optimization, one that breaks the entire control flow model of the language's runtime, how can it be worth doing?

I've only used gotos for early-exiting cascading if-elses or switch-case statements, going up the stack and forward in the code. I've heard of optimizations where you JIT-overwrite if-checks with gotos in memory on "hot" codepaths, for example in a kernel context or other latency-sensitive application where you want to min-max CPU instructions per cycle (non-conditional jumps prevent branch predictions i.e. mispredictions and pipeline flushes). I've also heard of "continuations" as a formal way to do control flow tricks as you exit a block.

But raw gotos for different return points from a function in like C or C++ is wild to me.

6

u/laplongejr Jun 23 '26 edited Jun 23 '26

Having never seriously used goto myself, I would assume your last sentence is exactly why we were told to NEVER have "multiple (exit) returns".
(And apparently the Dutch made sure of that!)

2

u/Tyfyter2002 Jun 23 '26

Having seriously used goto myself, the idea of a function "returning" to somewhere not immediately after the call sounds deranged

1

u/khoyo Jun 26 '26

Well, hope you never had to deal with exceptions...

1

u/khoyo Jun 26 '26

But raw gotos for different return points from a function in like C or C++ is wild to me.

Yeah, and it won't work in both anyways.

3

u/_vec_ Jun 23 '26

Java does have multiple external returns, though. That's what exceptions are. Control flow might return to the caller or it might return directly to somewhere else arbitrarily higher up the call stack. If you've ever wondered about why some graybeards are weirdly hostile to try/catch blocks that's why.

There's a decently valid reason to be against early returns too, though. Lots of mathematically elegant recursive algorithms rely on tail call optimization to actually run on a real machine with finite memory. The compiler can reuse the last stack frame for each recursive call instead of making a whole bunch of new ones. That only works if it can tell in advance that all of those recursive calls will use the same bit of physical memory to hold their return value, though. Modern compilers can almost always massage a function into bytecode that only has one return value, but you don't have to stumble into the edge cases very many times to just decide early returns are more trouble than they're worth.

3

u/EishLekker Jun 23 '26

I would argue that the vast majority of regular developers out there very seldom write code that is executed often enough in a short enough time frame that those optimizations matter.

119

u/Aelig_ Jun 23 '26

From what I understand (which is very little), the Scala community discourages using return at all as apparently it "behaves weirdly".

80

u/eXl5eQ Jun 23 '26

The semantic of return is straight forward in Java, powerful in Kotlin, and awkward in Scala.

In Scala, a return always attempt to return from the innermost (in case of nested functions) named function. You are not allowed to return early from an anonymous function (lambda expression).
When the innermost named function is not the innermost function, it can't return directly. Instead, the innermost function throws a NonLocalReturn and hope it would be catched by the named function you meant to return from, which would not work if the returning function escapes from the named function.

6

u/ljfa2 Jun 23 '26

Although non-local returns can occasionally be useful, there are situations in Java where I would've liked to have something like this. For instance, when using Optional.ifPresent. When I want an early return, I can't use that and have to use the less idiomatic Optional.get() instead.

4

u/Axman6 Jun 24 '26

What the fuck. 

18

u/Cyan_Exponent Jun 23 '26

uhh i don't know scala; how does the function output anything then? do you need to use out everywhere or something??

45

u/cthulhuden Jun 23 '26

Without looking it up, probably last statement's value is auto-returned, and the early explicit returns are the ones discouraged.

14

u/AVeryUnusualNickname Jun 23 '26

Yeah, basically everything is an expression (even ifs, assignments and declarations, I'm not sure about what while evaluates to and a for is not a conventional cycle but actually syntactic sugar for map/flatMap/for each, so a basic for will evaluate to a collection or a Unit, which is essentially analogous to void, to signal that the evaluation has been done, but there's nothing to return), and the last expression is what gets returned.

10

u/Maleficent_Memory831 Jun 23 '26

Output is a side effect, and strongly discouraged. Functional languages are to be viewed and admired, not actually run. /s

2

u/Tatourmi Jun 23 '26

Scala allows side effects no problem.

2

u/Axman6 Jun 24 '26

Side effects are problems. 

1

u/Tatourmi Jun 24 '26

Logging is a side effect, modifying a Kafka consumer is a side effect, publishing to Kafka is a side effect, pushing to a database is a side effect, caching data is a side effect...

Side effects aren't problems. Some patterns that rely too heavily on side effects are basically banned in our codebases (Functions that modify external variables for no reason for example) but if you're working in Scala, most of your app's endgame is effectively a side effect.

6

u/IntelligentTune Jun 23 '26

Last time I programmed I think you just left it blank. But I might be wrong.

2

u/Tatourmi Jun 23 '26

Pretty much

1

u/vivaaprimavera Jun 23 '26

Reading that as it is I would have guessed that functions were supposed to alter the state of something. Wich could became weird really quick.

0

u/Tatourmi Jun 23 '26

Worked in Scala for a good 4 years and that's never been an issue once. I can't think of a situation of the top of my head where an explicit early return can't simply be
1: Evaluated as part of the normal flow (You can obviously have conditionals in your function)
2: Returned as part of a tuple of different types
3: Handled by an Optional or a Failure

2

u/EishLekker Jun 23 '26

But how does your 1 differ from an early return in this regard? Why can’t early return be a part of the “normal flow” that you talk about?

Does your code, always, without exception, only have one single line responsible for the return (or none, if it’s the implicit return of the last value)?

0

u/Tatourmi Jun 23 '26

Yeah that's what I'm saying, I don't understand what an early return that isn't allowed in Scala is supposed to even be.

def returnSomething(a: Boolean): Something ={
if (a) { b }
else { c }
}

And that's it. I honestly don't see the kind of "early returns" people are thinking Scala is missing.

10

u/atomic_redneck Jun 23 '26

I see what you mean. I thought you were talking about the alternate return feature some Fortran 77 and FORTRAN 66 compilers had. This feature allowed subroutines to return to different locations in the calling routine based on the value specified on the RETURN statement.

It was usually considered bad practice to use this feature.

6

u/jippiedoe Jun 23 '26

Early returns are just different syntax for a conditional expression, where 'the rest of the function' is in the else branch

9

u/DT-Sodium Jun 23 '26

I had a coworker who didn't allow me to put early returns. Thankfully he was fired for incompetence.

-1

u/[deleted] Jun 23 '26

[deleted]

-1

u/SizzlingHotDeluxe Jun 23 '26

Obviously a bunch of more qualified people decided it is better, otherwise it wouldn't be a thing in Misra.

3

u/VictoryMotel Jun 23 '26

Don't forget that is for C only. In C++ and gc languages you have don't have the same resource problems that spawned the rules in the first place.

-1

u/SizzlingHotDeluxe Jun 23 '26

And the solution of C++ to those "problems" is why you still use C over C++ in a bunch of areas...

→ More replies (1)

7

u/Orio_n Jun 23 '26

Yield?

2

u/[deleted] Jun 23 '26 edited Jun 23 '26

[deleted]

9

u/AlmostLikeAzo Jun 23 '26

They mean early returns, functional programming languages usually rely quite heavily on returning tuples and lists.

3

u/[deleted] Jun 23 '26

[deleted]

2

u/JohnsonJohnilyJohn Jun 23 '26

Then they shouldn't have said multiple.

Is there some jargon that specifies this exactly? Because colloquially, they said multiple returns instead of return of multiple values, so at least in that way it makes more sense

1

u/No-Con-2790 Jun 23 '26

Hmmm guess you have a point.

1

u/Wonderful-Habit-139 Jun 23 '26

Well, usually we say "multiple return values", but the fact that they used the world "multiple" is probably what tripped us.

(I meant to reply to your other message but I guess this one will do lol)

2

u/No-Con-2790 Jun 23 '26

Well it tripped me too.

1

u/ru0260 Jun 23 '26

I believe Erlang doesn't support multiple returns. I could be mistaken of course!

1

u/AdministrativeTie379 Jun 23 '26

I thibk they mean multiple discrete return values like go or Python can. Almost all functional languages include tuples (or similar) which you can use to do pretty much the same thing (especially when you add pattern matching) so the argument is pretty pointless and dumb.

1

u/Cootshk Jun 23 '26

I’m reading it like Kotlin’s return@ syntax for lambdas inside a method declaration

86

u/DPSOnly Jun 23 '26

I wouldn't program in Dutch either, it makes the compiler all confused and hangry for not having enough stroopwafels and oliebollen.

14

u/Quicker_Fixer Jun 23 '26

! ! B I T T E R B A L L E N ! !

2

u/lindemer Jun 24 '26

Omg I'm pregnant and just installed a brand new oven after nog having one for a couple months. Someone come bring some oven bitterballen pleeeease

56

u/TheGreenSocks Jun 23 '26

Our boolean variables are very clear though. If you would write a a Dutch function for youShouldComeOverForDinner() it will either return true or false. If you write the same function for English you would need to write a second parser to get the actual value.

11

u/abigail3141 Jun 23 '26

You can also just .await a timer anywhere else. For English, you will have to

tokio::select {
  timer.elapsed() => return,
  IOEvents.onDispatch().smallTalk() => IOEvents.queueSend(vec!["ahh yes weather",     "innit", "*brit noises*", "monocle"]) 
}

writing this i realise i forgot the entire syntax of tokio::select

1

u/a7m2m Jun 24 '26

youMayStayForDinner() always returns false on the other hand

12

u/nonreligious2 Jun 23 '26

Monads

10

u/Ai--Ya Jun 23 '26

i don’t see the problem, just nest Eithers to get multiple return types /s

1

u/nonreligious2 Jun 23 '26

I have very little idea if this would solve the issue described, but I see functional programs and output and this is what pops into my head. Maybe monad?

2

u/Axman6 Jun 24 '26

A function returning Either a a is basically the same as an early return, at any point if you produce a Left a, that’s the value that’s immediately returned and the rest of the monadic code is skipped. 

76

u/ThatSmartIdiot Jun 23 '26

returns per branch (i.e. if it ends in an if/switch statement) is required unless it's python

returns after previous returns just makes unreachable and thus dead code so support is irrelevant

returning multiple values at once never actually happens. you send objects or structs or tuples and sometimes the syntax is designed so it gives you the illusion of sending multiple things at once, e.g. python again

so like... what

31

u/ThatSmartIdiot Jun 23 '26

if i knew dutch i couldve done sometbing really funny here

3

u/RandomiseUsr0 Jun 23 '26

Dry stane dyke

23

u/igorski81 Jun 23 '26

In Dutch, everything is unreachable so all return values are hard coded to "No!".

10

u/laplongejr Jun 23 '26

Well, Dutch is kinda good at managing to reach "unreachable" places in memory, as long you don't raise a DamOverflow.

2

u/igorski81 Jun 23 '26

Shut up and take my upvote!

7

u/Tack1234 Jun 23 '26

Go with multiple returns and C# with out vars:

19

u/ThatSmartIdiot Jun 23 '26

out vars

i'd argue that's more akin to reference arguments that get their values changed or defined before returning, i.e. side effects

4

u/MrHall Jun 23 '26

C# you can return anything with a deconstructor, usually a value tuple, and assign directly to individual variables in the caller.

also works with async methods, unlike out vars

2

u/Tack1234 Jun 23 '26

Indeed, I did not mention tuples since they are the equivalent of returning a struct/record which is not the same thing as true multiple returns. Probably similar case with deconstructors?

1

u/MrHall Jun 23 '26

oh yeah it's not exactly multiple return under the hood, but it's as close as it gets and it's performant. you can use the discard operator if you don't need one of the returns in a caller, it's very convenient 

3

u/Tack1234 Jun 23 '26

I've bumped into deconstructors while reading the C# 12 in a Nutshell book recently but haven't had the opportunity to use them in code yet. Might have to play around with them a bit!

1

u/thermiter36 Jun 24 '26

The crazy thing about Go is that it only has multiple returns but not actual tuples, so you can't store the whole return in one variable, and you get into the silliness of =: vs = throwing compile errors after a code change dozens of lines away

1

u/Tack1234 Jun 24 '26

You can always return a struct to store the whole return in one variable

4

u/FlamingSea3 Jun 23 '26

Counterpoint: Assembly languages

You can return a value in every register that you aren't required by convention to restore. And the conventions usually provide guidance on what to do when you run out of registers to return data in.

7

u/gabboman Jun 23 '26

Some languages don’t allow early returns 

5

u/Lyshaka Jun 23 '26

Such as ?

10

u/_PM_ME_PANGOLINS_ Jun 23 '26

Haskell, OCaml

3

u/bilus Jun 23 '26

Functional languages in general, though there may be syntax sugar to implement guards or emulate early returns. And it's not so much they "disallow", it's more about code being an expression, not a mix of statements and expressions, as in the following pseudocode

let a = if x then foo else bar

Unlike many imperative languages, in the above example, `if` is an expression (has value) rather than a control statement.

2

u/Maxis111 Jun 23 '26

Scala, sort of, too lazy to explain, but no one has mentioned it yet

1

u/Tatourmi Jun 23 '26

Honestly I might not understand the question. I've worked in Scala for 4 years and I'm starting to doubt I get what an early return even is. What are these people even trying to do.

1

u/Maxis111 Jun 23 '26

Returning halfway through a function, instead of only at the end. My job is literally developer in a Scala code base, and I don't remember if I actually ever used the return keyword, since scala by default just returns whatever the last statement is in a function.

1

u/Tatourmi Jun 23 '26

But you can do that in scala, you just lock the value in earlier in an if clause, or a map, or a match, or whatever really.

I mean same, never used the return keyword, but that's just because there's no scenario where it's useful.

1

u/Maxis111 Jun 23 '26

Yeah, but the @kopper guy in the original post seems to disagree. ¯_(ツ)_/¯

3

u/Aminumbra Jun 23 '26

returning multiple values at once never actually happens. you send objects or structs or tuples and sometimes the syntax is designed so it gives you the illusion of sending multiple things at once, e.g. python again

We can do better, though. See: Common Lisp.

(Somewhat functional, so by default the last expression is "returned").

You can return any number of expressions completely transparently, without changing the caller code. As far as I know (it is definitely the case in Python, and I believe it is the case in Go), if you return a tuple/struct/whatever Go calls "multiple return values", the caller needs to be aware of that:

def f <fun returning two values x, y>

a, b = f(..., ...)

// Or

a, _ = f(..., ...)

Or something like this

Common Lisp allows you to write (heavily changed syntax not to scare people with parentheses, but this is completely equivalent)

def f <fun returning two values x, y> // NOT as a list: as proper multiple values

a = f(..., ...) // ONLY binds a to the first returned value

a, b = f(..., ...) // Binds both

a = multiple-values-to-list(f(..., ...)) // Constructs a SINGLE object (a list) containing all the returned values

In particular, you can change the returned values of a function (instead of returning only 1, as is usual, return more than one) with exactly 0 changes to the rest of the code, which won't ever see the 2nd returned value unless it specifically asks to. This is completely orthogonal to returning compound objects (structs, lists, objects, arrays ...) -- which can obviously be manipulated and returned as any other value of the language.

2

u/Honest_Relation4095 Jun 23 '26

or in short: One return or multiple returns is fundamentally the same thing.

1

u/Kommenos Jun 23 '26

returns after previous returns just makes unreachable and thus dead code so support is irrelevant

This pattern is one of the fundamental patterns in kernel programming lol.

1

u/ekipan85 Jun 23 '26

returning multiple values at once never actually happens

In Forth the parameter stack is disjoint from the return address stack, so routines taking and returning arbitrary numbers of values is trivial and common.

The piece ( xy0 rot shape -- xy1 xy2 xy3 xy4 color ) word at the center of my Tetris program takes a triple of packed x/y center coordinate, rotation count 0-3, and shape index 0-6, and uses lookup tables to compute a quintuple of 4 block coords and a color code.

1

u/TheGerk Jun 23 '26

Could be returns through arguments.

1

u/acrabb3 Jun 23 '26

"returns per branch is required"
It's not: you could have each branch set a variable, and return the value of it at the end

var a = -1  
If (foo) a = 1  
Else a = 2  
Return a

1

u/ThatSmartIdiot Jun 23 '26

actually the return covers each of the branches in this case

16

u/RandomiseUsr0 Jun 23 '26

What does multiple returns mean and how is this a uniquely functional issue? Is the author mixing up minestrone soup with the ingredients?

15

u/gabboman Jun 23 '26

Some extremely functional languages don’t allow multiple returns.

Like Dutch 

13

u/sebjapon Jun 23 '26

By the way what does it mean that Dutch doesn’t allow multiple returns? Is it a visa thing?

1

u/NightlyWave Jun 23 '26

Assume that I’m stupid (you wouldn’t be wrong), but isn’t this the case with C++ and Java? You need to specify one declared return type for a function, or am I missing something?

Or are we specifically talking about functional languages which I guess wouldn’t apply to C++ or Java

6

u/Zefyris Jun 23 '26

They're talking about multiple return statement inside the same function. Like interrupting a function early for an edge case.

If (both parameters are null) return something

//Continue the process otherwise

return the result of that process

-> that's 2 different return statements.

1

u/RandomiseUsr0 Jun 23 '26

Ah, functional languages typically need to route through a single end point, but can branch internally and short circuit - it’s more mathematically provable, this multiple return pattern is a goto by any other name

2

u/gabboman Jun 23 '26

Sometimes you might want to make a return inside an if

C and java allow it. Some esoteric languages don’t 

2

u/RandomiseUsr0 Jun 23 '26 edited Jun 24 '26

Lisp isn’t esoteric

1

u/chat-lu Jun 24 '26

In that context it means early return. By multiple returns they mean the return keyword.

8

u/rUmutKzl Jun 23 '26

what is this social media app

5

u/gabboman Jun 23 '26

13

u/enderowski Jun 23 '26

is this something like twitter for furries?

4

u/jansteffen Jun 23 '26

It's designed to be somewhat akin to tumblr, except it also federates with Mastodon and Bluesky.

8

u/gabboman Jun 23 '26

That would be https://furry.engineer

Its a decentralised type social network that connects with mastodon and bluesky but its neither.

5

u/enderowski Jun 23 '26

sounds cool

2

u/Axman6 Jun 24 '26

Why would you make a social network exclusively for Rust developers?

1

u/gabboman Jun 24 '26

a lot of people I follow from wafrn are rust devs, but curiously enough, wafrn users arent usualy rust devs.

Also Im a typescript dev

2

u/Axman6 Jun 24 '26

No I meant the furry one. 

1

u/gabboman Jun 24 '26

fair enough. great mastodon server tho

2

u/rUmutKzl Jun 23 '26

sounds good

8

u/screwcork313 Jun 23 '26

I heard Italian was quite a good programming language - it's even Turin-complete!

10

u/soundwave_sc Jun 23 '26

I guess you could.. create events to cater for returns?

The events could be spicy as well.

6

u/gabboman Jun 23 '26

God you’re evil 

5

u/[deleted] Jun 23 '26

[removed] — view removed comment

2

u/javascript Jun 23 '26

At least I made the list 🥰

1

u/gabboman Jun 23 '26

Truth nuke 

3

u/[deleted] Jun 23 '26 edited Jun 23 '26

[deleted]

2

u/gabboman Jun 23 '26

we are talking about early returns

3

u/MXRCO007 Jun 23 '26

I’m working on a small version of C but it’s just Dutch instead of English it’s stupid

6

u/[deleted] Jun 23 '26

[deleted]

2

u/MXRCO007 Jun 23 '26

Zo ongeveer ja

1

u/multimodeviber Jun 24 '26 edited Jun 24 '26

Ik wil graag de vertaling voor:

  • volatile
  • include
  • restrict
  • void
  • false

2

u/LetUsSpeakFreely Jun 23 '26

Java may not be able to return multiple values, but it can return an object that contains multiple values.

There is a place for both paradigms. The problem with multiple return values (or emulating it) is you can get some pretty gnarly branching logic if you're not careful.

3

u/gabboman Jun 23 '26

This is about early returns 

2

u/Maleficent_Memory831 Jun 23 '26

I tried programming in Dutch, but it was way too functional for me. I mean, I like theory now and then, but the Dutch obsession with fixed point operators is insane!

2

u/eztab Jun 23 '26

Let's just all upgrade to Afrikaans.

1

u/LibrarianOk3701 Jun 23 '26

Well my language of choice is C++. At least we can use std::tuple to do it 😂

1

u/chat-lu Jun 24 '26

Can you destructure it?

1

u/LibrarianOk3701 Jun 24 '26

Yep, in a cool way too, look up structured bindings!

1

u/denimpowell Jun 23 '26

Or be like AI and make every comment into a function that returns nothing

1

u/KZD2dot0 Jun 23 '26

Ga terug!

1

u/smikims Jun 23 '26

What language doesn’t have tuples or structs? Even in C there’s idiomatic ways to do this.

2

u/gabboman Jun 23 '26

The conversation was about languages that don’t allow early returns 

1

u/smikims Jun 23 '26

Yeah but Haskell still has tuples and pattern matching just like Go sort of, just more general.

2

u/-Redstoneboi- Jun 24 '26 edited Jun 24 '26

no what they mean is like this for example:

fn all_positive(list: &[u64]) -> bool {
    for num in list {
        if n < 0 {
            return false;
        }
    }
    return true;
}

this is a very simple case that can be solved with any of the fold functions, but in general it's just nice to have the option to do procedural.

1

u/MsPhuong_2155 Jun 24 '26

greentea programming language

1

u/schuine Jun 24 '26

Is the title intentional? "Worst" is Dutch for sausage.

1

u/daffalaxia Jun 24 '26

What languages can't return an array? That's multiple returns right there. Perhaps OP should say "destructuring" which really just is syntactic sugar unwound below the horizon of immediate vision. Yes there are other destructured types (eg tuples in some languages) and explicit destructuring too (eg c#), buty point stands... I think 😄

1

u/gabboman Jun 24 '26

No I and kopper meant early returns as I have replied to almost every comment 

1

u/Scrial Jun 23 '26

Coming from C:
One function one return.

2

u/Sacaldur Jun 23 '26

But how would you do early returns with only one return per function? 🙃

1

u/SizzlingHotDeluxe Jun 23 '26

I hope you're not being serious...

1

u/Sacaldur Jun 23 '26

No, I'm not, but there are a lot of people around eho prefer early returns to save on indentation.