News for hackers. Stuff that matters.
Re:قلب: a non-ASCII programming language written in Arabic by babuskov on Friday October 25, 2019 @04:16AM (#21352890)
Agreed. I started to program in BASIC some 7 years before I started to learn English. I had no idea what PRINT or LET meant and was able to program without any problems.

Hm, even today, I have not idea why "for" is used for loops (?) and I'm using it without any problems.

Re:قلب: a non-ASCII programming language written in Arabic by Scarblac on Friday October 25, 2019 @05:12AM (#21353173)
When I was 10, the Dutch language manual for the Commodore 64 explained the pronunciation of "input#", but not that of just "input". So I (unfamiliar with foreign languages) thought that "input" was pronounced as we would in Dutch, while "input#" sounded like what I now know is English.

A class mate said his father said they were both pronounced as in English.

We had a fight over this in the playground, and I beat him. So I was right. "input" on the Commodore 64 is pronounced like in Dutch.

Re:قلب: a non-ASCII programming language written in Arabic by 317070 on Friday October 25, 2019 @06:41AM (#21353604)
My brain is parsing how a Dutch input would sound different in Dutch? "in de put" vs "input" sounds the same, no? What is different?
Re:قلب: a non-ASCII programming language written in Arabic by Scarblac on Friday October 25, 2019 @07:49AM (#21354018)
That's how I pronounced it. English input sounds more like Dutch "inpoet", the manual said input# was pronounced "inpoet-nummer".

(edit: long live the Internet, it's on page 135 of the manual here: https://docplayer.nl/11208014-Gebruikershandleiding-nederlan... . Nostalgia).

Re:قلب: a non-ASCII programming language written in Arabic by ward on Friday October 25, 2019 @07:47AM (#21354009)
There is definitely a difference. If you don't hear it, you might be saying one of them incorrectly? Wiktionary has audio files for input (English) and put (Dutch) if you need a comparison. In IPA the difference is ʊ vs ʏ. In terms of describing it to a Dutch person I would say the English u is somewhere between the Dutch u and the Dutch oe sounds.
Re:قلب: a non-ASCII programming language written in Arabic by Vinnl on Friday October 25, 2019 @07:53AM (#21354049)
In-poot vs in-puht, roughly.
Re:قلب: a non-ASCII programming language written in Arabic by dkersten on Friday October 25, 2019 @04:55AM (#21353093)
I always translate “for” in my head to: for each item x in...

In python is pretty direct: “for x in a” translates for for every x in the collection a, do this code...

In C it’s a bit more abstract: “for (i=0; i<10; ++i)” for every i in the range starting at i=0, while it’s less than 10, incrementing... Basically the body establishes a set or collection and the for loop executed the loop body “for” every item in the collection.

Modern languages often use foreach or some other slightly more descriptive name.

Re:قلب: a non-ASCII programming language written in Arabic by Fordec on Friday October 25, 2019 @04:46AM (#21353044)
Originally it was a Anglicization of "für" in German first used in a programming language called Superplan which was then picked up upon by FORTRAN and then it just stuck
Re:قلب: a non-ASCII programming language written in Arabic by dukoid on Friday October 25, 2019 @05:58AM (#21353382)
https://en.wikipedia.org/wiki/Heinz_Rutishauser

I don't think it's much more intuitive in German than in English, probably goes back to the "for each" quantor.

Re:قلب: a non-ASCII programming language written in Arabic by bhaak on Friday October 25, 2019 @06:37AM (#21353579)
The for loop is the most unintuitive variant of the possible looping constructs. The others (while do/do while/endless loop) are much more straightforward. We could easily have ended up with another version.

I always read it as inspired by "for values of" which at least in German is a common phrase heard in mathematical courses.

Re:قلب: a non-ASCII programming language written in Arabic by eru on Friday October 25, 2019 @05:49AM (#21353342)
Well, that doesn't really solve the mystery. The German "für" doesn't have any closer connection with loops than English "for".
Re:قلب: a non-ASCII programming language written in Arabic by kuschku on Friday October 25, 2019 @06:30AM (#21353545)
e.g. in Sums or Products, with

$$ Σ_(i=0)^(20) x² $$

you'd actually pronounce that as "summe für i = 0 bis 20 von x²", which is a good argument for where it might be from.

Re:قلب: a non-ASCII programming language written in Arabic by eru on Saturday October 26, 2019 @09:11AM (#21363440)
Yes, though isn't that the same when pronouncing math in English? (So it's a good explanation, but doing the detour via German doesn't give us any extra enlightenment?)
Re:قلب: a non-ASCII programming language written in Arabic by kuschku on Saturday October 26, 2019 @09:47AM (#21363635)
Well I don't know how it's pronounced in English, so I didn't know that, good to know though:)
Re:قلب: a non-ASCII programming language written in Arabic by pletnes on Friday October 25, 2019 @06:20AM (#21353497)
Fortran has «do» loops, no «for» loops (to my knowledge). do i = 1, N ...
Re:قلب: a non-ASCII programming language written in Arabic by jdnenej on Friday October 25, 2019 @04:20AM (#21352915)
Native English speaker and I also don't really get what "for" was meant to mean. At this point it's probably just something that everyone has memorised and part of history.
Re:قلب: a non-ASCII programming language written in Arabic by yodsanklai on Friday October 25, 2019 @04:44AM (#21353032)
I'm not a native speaker, but "perform this task, for i in {1,2,3}" seems to make sense as a prose. At least it does in French, when translated literally.
Re:قلب: a non-ASCII programming language written in Arabic by ozzmotik on Friday October 25, 2019 @05:18AM (#21353203)
personally as a native speaker it has alwaus made sense to me in the sense of saying "for these given constraints, loop while they are maintained" for the arithmetic style for loop, and "for each of these elements" for the more iterator based style.
Re:قلب: a non-ASCII programming language written in Arabic by jdnenej on Friday October 25, 2019 @05:53AM (#21353360)
In python it makes sense but when you have `for(let i=0; I<length; I++)` it makes less sense
Re:قلب: a non-ASCII programming language written in Arabic by wongarsu on Friday October 25, 2019 @07:38AM (#21353958)
"for all i smaller than length, starting at 0". It doesn't really map perfectly because in math you usually don't care about the order, so a for loop actually contains more information than the statement it's trying to mimic.
Re:قلب: a non-ASCII programming language written in Arabic by krzrak on Friday October 25, 2019 @04:52AM (#21353076)
The same in Polish.
Re:قلب: a non-ASCII programming language written in Arabic by trophycase on Friday October 25, 2019 @03:33PM (#21358458)
Huh? It's pretty common even in basic college math courses to use language like "for every p in Q". It's not like programming invented this usage.
Re:قلب: a non-ASCII programming language written in Arabic by Izkata on Friday October 25, 2019 @08:58AM (#21354488)
Also native English: For me it's always made sense only with the loop body, as "for these do that"

Or more straightforwardly, in a way that can be applied to other English constructs, "do that for this group"

It's the same "for" in my head in both those versions.

Re:قلب: a non-ASCII programming language written in Arabic by jhiesey on Friday October 25, 2019 @05:08AM (#21353157)
I would guess it comes from calling the universal quantifier ”for all” in logic
Re:قلب: a non-ASCII programming language written in Arabic by quickthrower2 on Friday October 25, 2019 @05:47AM (#21353325)
You have high hopes!
Re:قلب: a non-ASCII programming language written in Arabic by tempguy9999 on Friday October 25, 2019 @04:43AM (#21353022)
Hmm, never thought about it either. I'd guess a contraction of "for each value..."
Re:قلب: a non-ASCII programming language written in Arabic by tuesdayrain on Friday October 25, 2019 @04:49AM (#21353061)
Could it really be anything else? I always assumed that was the obvious intention there. Never crossed my mind that it could mean anything too different.
Re:قلب: a non-ASCII programming language written in Arabic by nindalf on Friday October 25, 2019 @04:41AM (#21353008)
My high school teacher had a very legit explanation for the meaning of “for” in that context. But I can’t remember it now. Nowadays I write it because it’s expected, not because there’s a hidden deeper meaning.