Linguistics and Programming Languages (2006)
250bpm.com
250bpm.com
Imagine what a programming language that had things like phatic expressions would be like.
On the other hand, typing can be seen as analogous to grammatical gendering. In this case, English would probably be dynamically typed or at the very least has type inference whereas German or Russian would be statically typed without any inference (since you need to match the gender of multiple parts of a sentence in what is known as agreement). This also reminds me of Hungarian notation.
No wonder programmers never liked static typing the same way nobody learning German ever liked the der/die/das overload.
https://code.sgo.to/2021/07/02/english--.html https://code.sgo.to/2020/08/31/syntactic-theory.html https://code.sgo.to/2020/09/16/semantics.html
That is, when I'm talking to a human, I say "read in a line of text. If it ends in a newline, remove it". A human understands that. But a programming language says, "Read the line in from where? Read the into what variable? And, if what ends in a newline?"
But Perl has a default place to read input from, so if that works, you can just say "read in a line" without specifying from where. And it has a default variable, which is where the line will be stored if you don't specify somewhere else. That variable plays the role of "it" - it's what we're talking about if we don't specify something else. So "if it ends in a newline" means "if the default variable ends in a newline" without having to actually specify that I mean that variable.
It's very handy. And, like "it" in English, it can also cause confusion.
But I (a non-linguist) think it's linguistically interesting.
The other function is as a dummy subject, as in "it rained", "it's cold". English grammar requires a subject (unlike many other languages, where a pronoun in subject position can be ommitted without the sentence becoming ungrammatical). So here "it" doesn't refer to anything, it's (haha) just there to fulfill a syntactic requirement
t. linguist
eg:
some_list_of_things.each { print(it) }