I got the idea for this question after reading an answer by Martin Ender here. It more-or-less says: Functions in stack-based languages can leave the output on the stack. This question is also similar to What even is a “function” by our standards?.
I use ><> and to me, a function is just when I store my current location on the stack, jump to the function, and then ultimately return to my previous location. This is similar to how I'd do it in nasm with
ret. So then in some languages, how exactly do we define a function?
I mean, isn't a function just storing your location on the stack, jumping to the function, and then ultimately jumping back? Seems a bit loose considering how big of a role this rule plays for certain esolangs.
Even when considering this answer by Downgoat which says It is a section of code, which can be directly inserted into a program with no modification, and should be able to be assigned/named/referred to in some way., it still leaves it unclear as to what other golfers really would be happy with. In my opinion, many esolangs blur the line between program and function by this definition (I can copy almost any of my ><> programs directly into another ><> program, and jump to it with just
><> and asm would be my two biggest examples of languages with ambiguous functions, but I'm sure there are a lot more.
So I ask, what exactly is the criteria for a function? Preferably providing at least one clear example of what is and isn't a function in at least two languages which do not officially define what a function is.