Page 1 of 4

Are computer languages meaningfully... in english?

Posted: Fri Jan 27, 2023 8:30 pm
by Torco
So I've got to wondering... well, the title of this thread: on the one hand, sure, programming languages use english lexicon, right? it's print, not imprima or imprimir. I know a few <not many> programming languages and I've noticed they're all very similar, if not in syntax, in some deeper structures: for example, as English is mostly uninflected, so are I would say all programming languages: and it's not like you couldn't have built inflection into proglangs either: is this cause of technical reasons or simply because the first programmers were english speakers and we all sort of went along? an example of the latter case is almost certainly, to my mind, the case for the way we declare variables: token is equal to expression is, well, a reflection of how you state that a thing is the case in English, right? I'm a sociologist: but it could just as easily have been the other way around: a proglang could express

MyVar=21

as

means 21 MyVar

And would probably be the case if some other natlang had been the L1 of the guys who wrote the first assemblers or whatever.

Is this like... a thing? like, have people thought about this... linguistic parochialism of the way proglangs are, and alternative ways in which they could work? this is not an area I know a lot about.

Re: Are computer languages meaningfully... in english?

Posted: Fri Jan 27, 2023 10:25 pm
by Vardelm
Torco wrote: Fri Jan 27, 2023 8:30 pmEnglish is mostly uninflected, so are I would say all programming languages: and it's not like you couldn't have built inflection into proglangs either: is this cause of technical reasons or simply because the first programmers were english speakers and we all sort of went along?
I'd say technical. It's much easier to parse arguments between spaces than to try & deconstruct a string of character.

Torco wrote: Fri Jan 27, 2023 8:30 pmI'm a sociologist: but it could just as easily have been the other way around: a proglang could express

MyVar=21

as

means 21 MyVar
Yeah, this could happen. I do some scripting for my job, and I can tell you I wouldn't want to type "means" instead of "=" every time I needed to assign something. It's 5x the work! (I didn't even feel like writing out "times" there.... crap. I just did...) "=" is an already available symbol that means something very close to what it's doing in programming, so why not use it? Also, when you're scanning code, I'd say that the "=" signs will just out a little bit from the surrounding text, making it easier to ready.

Re: Are computer languages meaningfully... in english?

Posted: Fri Jan 27, 2023 11:14 pm
by Emily
i feel like i saw something somewhere, as a joke or proof of concept or something, where someone made a programming language using latin inflection as a part of its structure

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 1:26 am
by zompist
Torco wrote: Fri Jan 27, 2023 8:30 pm for example, as English is mostly uninflected, so are I would say all programming languages: and it's not like you couldn't have built inflection into proglangs either: is this cause of technical reasons or simply because the first programmers were english speakers and we all sort of went along?
Not a COBOL guy, are you? Take a look at this:

https://www.microfocus.com/documentatio ... DF205.html

In particular, the optional use of CHARACTER or CHARACTERS, and the use of IS or ARE.

But that perhaps leads to the question, why bother? Most languages went for much more terseness, rather than directly mimicking English. I don't think anyone wants the computer to refuse to compile if you use IS where you should have used ARE, and it's hard to think of an example where inflections would help out the coding any.
an example of the latter case is almost certainly, to my mind, the case for the way we declare variables: token is equal to expression is, well, a reflection of how you state that a thing is the case in English, right? I'm a sociologist: but it could just as easily have been the other way around: a proglang could express

MyVar=21

as

means 21 MyVar
Sure, though I'd note that that's VOS which is extremely rare in the world's languages.

I'd also note that messing with expression syntax is totally a thing-- some languages go for postfix notation. So people aren't limited to English models.

Obviously it's historical accident that most languages use English keywords. I once asked about this in a French Usenet group... why not (say) use C to define French keywords? But no one thought it was a good idea. Most French programmers probably know at least some English. And one even pointed out that the English keywords kind of stood out on the page (this was before syntax coloring).

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 1:36 am
by bradrn
Torco wrote: Fri Jan 27, 2023 8:30 pm So I've got to wondering... well, the title of this thread: on the one hand, sure, programming languages use english lexicon, right? it's print, not imprima or imprimir. I know a few <not many> programming languages and I've noticed they're all very similar, if not in syntax, in some deeper structures: for example, as English is mostly uninflected, so are I would say all programming languages: and it's not like you couldn't have built inflection into proglangs either: is this cause of technical reasons or simply because the first programmers were english speakers and we all sort of went along? an example of the latter case is almost certainly, to my mind, the case for the way we declare variables: token is equal to expression is, well, a reflection of how you state that a thing is the case in English, right? I'm a sociologist: but it could just as easily have been the other way around: a proglang could express

MyVar=21

as

means 21 MyVar

And would probably be the case if some other natlang had been the L1 of the guys who wrote the first assemblers or whatever.

Is this like... a thing? like, have people thought about this... linguistic parochialism of the way proglangs are, and alternative ways in which they could work? this is not an area I know a lot about.
I’ve thought about this on and off, and I don’t think programming languages are influenced all that much by L1s. Having written some parsers, I think the key constraints are that (a) code must be easy to segment into lexemes, and (b) it needs to be easy to determine syntactic structures by processing those lexemes in order. (a) makes code naturally tend to having an isolating character, and (b) means it’s mostly head-initial.

Of course, one might wonder if code really needs to have a syntactic structure in the first place…
Emily wrote: Fri Jan 27, 2023 11:14 pm i feel like i saw something somewhere, as a joke or proof of concept or something, where someone made a programming language using latin inflection as a part of its structure
…which is exactly what Lingua::Romana::Perligata does. I’m not sure it adds all that much expressivity, though.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 3:49 am
by alice

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 5:12 am
by Richard W
Is "can not" an unintentional mistake or a bit of word play?

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 5:18 am
by Richard W
Many programming languages largely lack lack pronouns. Perl has them, and routines can have a pronoun with fixed reference to an unchanging privileged, hidden argument, e.g. self.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 11:47 am
by Travis B.
Richard W wrote: Sat Jan 28, 2023 5:18 am Many programming languages largely lack lack pronouns. Perl has them, and routines can have a pronoun with fixed reference to an unchanging privileged, hidden argument, e.g. self.
A "pronoun" in programming languages, Perl and shell aside, tends to be idiomatic of object-oriented languages, as most OO languages, ones with multiple dispatch aside, tend to privilege a specific argument.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 1:15 pm
by Raphael
I'm kind of reminded of this zompist blog post:

https://zompist.wordpress.com/2015/12/0 ... interface/ ,

and specifically this quote:
One of programmers’ oldest dreams, or snares, is to write an interface that’s so simple to use that the business analyst can write most of the app. I’ve fallen for this one myself, more than once! The sad truth is even if you do this task pretty well, non-programmers aren’t going to be able to use it. To program, you have to think like a programmer, and this doesn’t change just because you make the code look like English sentences.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 5:24 pm
by bradrn
More thoughts: Perl sigils are basically noun classes, which must agree within a phrase / expression. (Perl is generally a good place to look for such things; Larry Wall has a linguistics degree.) J has something called ‘agreement’ too (though it’s somewhat different to the linguistic sense), as well as ‘nouns’ and ‘verbs’, and valency-changing operations, including something which could well be called a middle voice (passive/reflexive in one operation). More generally, type systems could be considered to be a form of agreement.

EDIT: This prompted me to search through my Perl book for linguistic stuff. I immediately found two pages on ‘topicalisers’ (i.e. packages and imports), as well as various entries in the glossary on ‘transliterate’, ‘possessive’, ‘indirect object’, ‘IPA’, as well as at least one IPA transcription ([modʑibake] for 「文字化け」.)
Raphael wrote: Sat Jan 28, 2023 1:15 pm
One of programmers’ oldest dreams, or snares, is to write an interface that’s so simple to use that the business analyst can write most of the app. I’ve fallen for this one myself, more than once! The sad truth is even if you do this task pretty well, non-programmers aren’t going to be able to use it. To program, you have to think like a programmer, and this doesn’t change just because you make the code look like English sentences.
The flipside of this is that a great many people do find themselves able to think like a programmer, once they’ve gotten past the syntax barrier — or more often, the marketing barrier. Consider the popularity of Excel as a programming environment, for one thing. I also once saw a story of secretaries who ended up creating complex packages in Emacs Lisp, because they thought of it as ‘configuring their editor’ rather than ‘writing a program’.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 7:10 pm
by Ketsuban
Torco wrote: Fri Jan 27, 2023 8:30 pm Is this like... a thing? like, have people thought about this... linguistic parochialism of the way proglangs are, and alternative ways in which they could work? this is not an area I know a lot about.
Yes. My favourite is قلب, a Lisp-like where you need to be reasonably comfortable with Arabic script to use it. I can't find it now, but I read something at one point about how the use of the word else ended up not really resembling how it's used in English because the person who introduced the construct was a native speaker of German.

Re: Are computer languages meaningfully... in english?

Posted: Sat Jan 28, 2023 10:42 pm
by bradrn
Ketsuban wrote: Sat Jan 28, 2023 7:10 pm I can't find it now, but I read something at one point about how the use of the word else ended up not really resembling how it's used in English because the person who introduced the construct was a native speaker of German.
I recall reading this too. I think I saved it somewhere, though probably on my old computer.

Re: Are computer languages meaningfully... in english?

Posted: Sun Jan 29, 2023 8:52 am
by Ryusenshi
I mentioned the same point here, linking to this article:
https://github.com/e-n-f/if-then-else/b ... en-else.md

Re: Are computer languages meaningfully... in english?

Posted: Sun Jan 29, 2023 8:55 am
by WeepingElf
Computer programming never really felt like talking to a machine to me, rather like building a machine or conducting a chemical experiment.

Re: Are computer languages meaningfully... in english?

Posted: Sun Jan 29, 2023 3:15 pm
by Travis B.
To me programming is essentially constructing or modifying a system, and programming languages are simply the notation used to do so. Just because they typically use English words to some extent does not makes them have anything more in common with English itself than, say, mathematical or chemical notations. To believe otherwise, to me, is to mislead oneself about the nature of programming itself.

Re: Are computer languages meaningfully... in english?

Posted: Sun Jan 29, 2023 5:26 pm
by bradrn
Travis B. wrote: Sun Jan 29, 2023 3:15 pm To me programming is essentially constructing or modifying a system, and programming languages are simply the notation used to do so. Just because they typically use English words to some extent does not makes them have anything more in common with English itself than, say, mathematical or chemical notations. To believe otherwise, to me, is to mislead oneself about the nature of programming itself.
I completely agree. I will note that there are many programming languages which use few or no English words in their syntax: for instance, APL (and its derivatives J and K), Prolog, to some extent Haskell and other ML-family languages, and so on.

Re: Are computer languages meaningfully... in english?

Posted: Sun Jan 29, 2023 5:29 pm
by Travis B.
bradrn wrote: Sun Jan 29, 2023 5:26 pm
Travis B. wrote: Sun Jan 29, 2023 3:15 pm To me programming is essentially constructing or modifying a system, and programming languages are simply the notation used to do so. Just because they typically use English words to some extent does not makes them have anything more in common with English itself than, say, mathematical or chemical notations. To believe otherwise, to me, is to mislead oneself about the nature of programming itself.
I completely agree. I will note that there are many programming languages which use few or no English words in their syntax: for instance, APL (and its derivatives J and K), Prolog, to some extent Haskell and other ML-family languages, and so on.
One thing to remember is also that just because English words are used in syntax or even in identifiers does not mean that the comments will be in English; in one piece of software I've dealt with written largely by some Germans much of the comments are in German (and make very obvious how limited my German is) even though the identifiers are largely in English.

Re: Are computer languages meaningfully... in english?

Posted: Mon Jan 30, 2023 6:44 am
by Torco
WeepingElf wrote: Sun Jan 29, 2023 8:55 am Computer programming never really felt like talking to a machine to me, rather like building a machine or conducting a chemical experiment.
absolutely, I have this same feeling: much more like plotting up a big rube goldberg machine, much less like a conversation. then again, jupyter notebooks feel more like a conversation (or, I'm told, R).

Re: Are computer languages meaningfully... in english?

Posted: Fri Feb 10, 2023 12:17 pm
by jcb
So I've got to wondering... well, the title of this thread: on the one hand, sure, programming languages use english lexicon, right? it's print, not imprima or imprimir. I know a few <not many> programming languages and I've noticed they're all very similar, if not in syntax, in some deeper structures: for example, as English is mostly uninflected, so are I would say all programming languages: and it's not like you couldn't have built inflection into proglangs either: is this cause of technical reasons or simply because the first programmers were english speakers and we all sort of went along? an example of the latter case is almost certainly, to my mind, the case for the way we declare variables: token is equal to expression is, well, a reflection of how you state that a thing is the case in English, right? I'm a sociologist: but it could just as easily have been the other way around: a proglang could express

MyVar=21

as

means 21 MyVar

And would probably be the case if some other natlang had been the L1 of the guys who wrote the first assemblers or whatever.

Is this like... a thing? like, have people thought about this... linguistic parochialism of the way proglangs are, and alternative ways in which they could work? this is not an area I know a lot about.
(1) Much of programming syntax is derived from (western) math syntax, which was mostly developed before english was the dominant european or world language.
(2) Most object-oriented languages nowdays have 2 different syntaxes (one derived from math, the other from english) that do basically the same thing. Compare:

Code: Select all

man.eat(apple) // englishy SVO
eat(man, apple) // mathy VSO

// but with operators, you're limited to SVO, which is what math also traditionally uses for operators anyways
2 + 3
(+) 2 3 // doesn't exist in OO languages
But declarative functional languages (like haskell and elm) have thought about this redundancy, and have either discouraged or ridded themselves of the first SVO type of function call:

Code: Select all

man `eat` apple -- works in haskell, but not elm
eat man apple -- note that in haskell and elm, the "subject" of the function/verb is traditionally the /last/ parameter of the function, not the first
eat apple man -- preferred style, because it makes making useful closures easier

2 + 3
(+) 2 3 -- useful when you need to pass the addition function to another function
Yeah, this could happen. I do some scripting for my job, and I can tell you I wouldn't want to type "means" instead of "=" every time I needed to assign something. It's 5x the work! (I didn't even feel like writing out "times" there.... crap. I just did...) "=" is an already available symbol that means something very close to what it's doing in programming, so why not use it? Also, when you're scanning code, I'd say that the "=" signs will just out a little bit from the surrounding text, making it easier to ready.
But what about the order ? Why not instead write ? :

Code: Select all

= 21 myVar
But even haskell and elm don't do this. ... Maybe because knowing which "subject" is being assigned is the most salient part of an assignment, and therefore it's best for the "subject" to come first.

(3) I think that "for" loops are awkward in most proglangs, and would probably have a different form if the programmers that created them had a different natlang phrase for what they do.