Are the characters used in syntax of most programming languages dependent on the keys of the standard keyboard or was the standard keyboard made specifically to allow programming with these keys? - eviltoast

The title would probably be confusing, but I could not make it better than this. I noticed that most programming languages are limited to the alphanumerical set along with the special characters present in a general keyboard. I wondered if this posed a barrier for developers on what characters they were limited to program in, or if it was intentional from the start that these keys would be the most optimal characters for a program to be coded in by a human and was later adopted as a standard for every user. Basically, are the modern keyboards built around programming languages or are programming languages built around these keyboards?

  • jflorez@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    17
    ·
    1 year ago

    Modern keyboards are an evolution of the old typewriter that existed before computers as we know them and programming as we know it existed, so I would say keyboard came first

      • mo_ztt ✅@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        1 year ago

        He’s not completely, though. @marcos had it right about co-evolution – leaving aside any issues of internationalization, the layout of letters came from typewriters, but the layout of punctuation available was different on different computers for a lot of the early history of programming. Some of the more extreme examples were the Space Cadet Keyboard used at MIT, and APL which more or less required you to use an APL-specific keyboard in order to be able to access all the special symbols that are part of APL. Here’s an APL program:

        ⎕CR 'ProveNonPrime'
        Z←ProveNonPrime R
        ⍝Show all factors of an integer R - except 1 and the number itself,
        ⍝ i.e., prove Non-Prime. String 'prime' is returned for a Prime integer.
        Z←(0=(⍳R)|R)/⍳R  ⍝ Determine all factors for integer R, store into Z
        Z←(~(Z∊1,R))/Z   ⍝ Delete 1 and the number as factors for the number from Z.
        →(0=⍴Z)/ProveNonPrimeIsPrime               ⍝ If result has zero shape, it has no other factors and is therefore prime
        Z←R,(⊂" factors(except 1) "),(⊂Z),⎕TCNL  ⍝ Show the number R, its factors(except 1,itself), and a new line char0  ⍝ Done with function if non-prime
        ProveNonPrimeIsPrime: Z←R,(⊂" prime"),⎕TCNL  ⍝ function branches here if number was prime
        

        Things became much more standardized when the IBM PC’s keyboard became the norm, and were formalized in 1995 with ISO 9995. Then once it stabilized there was a strong incentive for both language designers and keyboard makers to stick with what everyone was used to so they could keep working with the other. But it wasn’t always that way.

        Edit: Here’s what things looked like on an IBM 3276:

        (Full size image)

      • CrunchyBoy@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        3
        ·
        edit-2
        1 year ago

        Fun fact: the standard qwerty layout was made to slow typewriter typing down by putting common keys off the home row and apart from each other. This was done to prevent the little key arm thingies from colliding and jamming when typing quickly.

        EDIT: Apparently this is not a fact