Hacker News new | past | comments | ask | show | jobs | submit login
Linguistics and Programming Languages (2006) (250bpm.com)
41 points by larve on March 29, 2023 | hide | past | favorite | 9 comments



On a related note, recent brain research found that computer programming involve the logic related brain areas, not maths nor language as long suspected by previous researchers: https://hub.jhu.edu/2020/12/17/brain-activity-while-reading-...


Not surprising. The primary activity when programming is problem solving. The solution is then expressed in a programming language. This is unlike writing prose, poetry or miscellaneous text where the form of the text is important. Compared to natural languages, programming languages are very simple. There are no issues of formality, tone, etc. to care about. Unless you are programming in Intercal or Shakespear.

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.




Larry Wall, the creator of the Perl and Raku programming languages is famously a linguist. I was very surprised not to see him or his creations mentioned in this article.


Perl is interesting, because you can effectively say "it".

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.


"it" has two functions in English. the first is what you described. The technical term is an anaphor, basically a "syntactic variable" pronoun that stands in for a previous noun phrase in subject or object position. This inspired anaphoric macros in Common Lisp: https://en.wikipedia.org/wiki/Anaphoric_macro

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


A number of languages I've used also use `it` as a default variable in lambda's, which at first I found weird, but have grown used to .... it. hah.

eg:

    some_list_of_things.each { print(it) }


He was more of a missionary translating religious texts to local languages than an academic linguist.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: