The languages in the Visual Basic family do exactly this. This includes VBScript, VBA, Visual Basic and earlier. I believe these inherit the "feature" from QBASIC. For example
Public Function AddTwo(something as Integer)
AddTwo = something + 2
Fortran, for sure:
WRITE(UNIT=*,FMT=*)'Enter lengths of three sides:'
READ(UNIT=*,FMT=*) SIDEA, SIDEB, SIDEC
WRITE(UNIT=*,FMT=*)'Area is ', AREA3(SIDEA,SIDEB,SIDEC)
FUNCTION AREA3(A, B, C)
*Computes the area of a triangle from lengths of sides
S = (A + B + C)/2.0
AREA3 = SQRT(S * (S-...
The earliest such languages I can find are FORTRAN II and ALGOL 58, both published in the same year 1958; though the original FORTRAN (1956) can arguably also be included.
For FORTRAN, the first page of the manual chapter covering functions contains this example (p. 27):
FUNCTION AVRG (ALIST, N)
DIMENSION ALIST (500)
SUM = ALIST (1)
DO 10 I=2, N
SUM = SUM + ...
I'd say, most likely it is PASCAL you remember, as it was rather popular in the early 80s, used in University courses all thru the 80s way into the 90s and still had some fellowship there after, most notably Delphi.
The basic idea is that the function name is not only already reserved, so no need to come up with anything different, and ...
In some cases a sufficiently smart compiler could figure out some of
these precedence relationships.
was used in the 1979 book:
Chapter 3 - SIMSCRIPT: PAST, PRESENT, AND SOME THOUGHTS ABOUT THE FUTURE
Indicating that it predated Steele, and also that it ...
Fortran has used this syntax, from the earliest version which had functions at all right up to Fortran 2008 and beyond.
However Fortran 2008 has an (even more confusing?) option where you can declare a different variable name that is used to return a function value! For example
function xyz(argument) result(answer)
answer = 42
end function xyz
Algol 60 for one.
Here's the relevant words from the Revised Report on the Algorithmic Language Algol 60.
5.4.4. Values of function designators.
For a procedure declaration to define the value of a function designator there must, within the
procedure declaration body, occur one or more explicit assignment
statements with the procedure identifier in a left ...
The phrase any sufficiently advanced/smart/etc X in a technology context stems from (in other words, is a snowclone of) the Arthur C. Clarke's quote “Any sufficiently advanced technology is indistinguishable from magic” (1962 1973).
BASIC is another language with functions where some dialects used assignment to the function name to provide the return value. The earliest dialects were similar to Fortran single-line functions:
DEF FND(x) = x*x
But later dialects allowed more complex variants, similar to Fortran multi-line functions:
DEF FNPeekWord& (A&)
FNPeekWord& = PEEK(A&...
In C, if a variable has "static" in front of it, it is private to the code module. If someone decides to stick it in a header file, then every source file that #includes that header file will have their own private copy.
I believe that SNOBOL4 did this. http://berstis.com/greenbook.pdf
The following is an example of the definition and use of a function to
compute factorials of numbers:
* Set value to 1
FACT FACT = 1
* Return 1 if N<2
* Return N*((N-1)!) with recursive call
FACT = GT(N,1) FACT(N - 1) * N :(RETURN)
MATLAB / Octave also does this.
It is from 1984; so not as old as some of the others.
It was probably imitating Fortran, since it was orginally concieved as a high-level tool. On top of the Fortran libraries like Linpack and Eispack.
(I guess this isn't really retrocomputing, and more general programming languages theory ...)
"Private" in OOP is tied to a particular object, and non-OOP languages usually don't have objects.
If you allow other constructs:
Module systems in nearly all languages have a concept of "exported" vs. "non-exported" ("private"...