4 ms·
Hot take: @ might've been a good alternative.
by robertlagrant 3y ago
Hot take: @ might've been a good alternative.
- elurg 3y agoPascal uses this syntax. Also "pointer to integer" is written as "^integer" which is better than "int". Syntax also doesn't allow confusing stuff like like "int a, b;".
- brandmeyer 3y ago> "^integer" which is better than "int" I agree that it reads a little better. But as a small-handed person, it is unfortunately much more uncomfortable to type.
- sureglymop 3y agoHonestly that fully depends on your locale and keyboard layout. So it really shouldn't influence programming language syntax design.
- bmacho 3y agoMy computer has buttons, and characters printed on it. So I can't really change the distance between characters.
- extraduder_ire 3y agoAt the very least, &/* are in the same place on many keyboards, I've been bitten by muscle memory many times going back and forth between us/uk/fr keyboard layouts. For reference, it's above the ' and between the ;: and #~ keys on my current board, rather than on shift-2 (where " lives). Maybe this would have stayed consistent worldwide, if it was used in c.
- Dobbs 3y agoI didn't think @ took on the "at" meaning until email came around.
- johannes1234321 3y agoThe oldest trace of @ being used to mean "at" can be traced to typeriters for commerce around 1880, where it was used as "5 apples @ 10 p" meaning "5 apples at 10 pence each." At least that's what German Wikipedia Claims while the corresponding paragraph in english Wikipedia is short. https://de.wikipedia.org/wiki/At-Zeichen https://de.wikipedia.org/wiki/At-Zeichen https://en.wikipedia.org/wiki/At_sign https://en.wikipedia.org/wiki/At_sign
- jfk13 3y agoThe formal name of the Unicode character U+0040 '@' is, in fact, COMMERCIAL AT. https://en.wikipedia.org/wiki/At_sign#Unicode https://en.wikipedia.org/wiki/At_sign#Unicode
- Sanzig 3y agoIt's also the "a commercial" in Quebec French [1]. Despite lacking the accent on the A (à), the intention of the A is to stand in for the single letter French word "à" (at) [2]. [1] https://vitrinelinguistique.oqlf.gouv.qc.ca/fiche-gdt/fiche/8352403/a-commercial https://vitrinelinguistique.oqlf.gouv.qc.ca/fiche-gdt/fiche/... [2] https://www.noslangues-ourlanguages.gc.ca/fr/cles-de-la-redaction/a-commercial https://www.noslangues-ourlanguages.gc.ca/fr/cles-de-la-reda...
- gattilorenz 3y agoMore recently (but still 1968, before email): "In ALGOL 68, the @ symbol is brief form of the at keyword; it is used to change the lower bound of an array. For example: arrayx[@88] refers to an array starting at index 88."
- d-lisp 3y agoFrench wikipedia traces the usage of @ to signify "à" (at) back to Renaissance !
- tsimionescu 3y agoWhat do you think it meant before that?
- tsegers 3y agoI'd argue @ is more suitable for a dereference operation than an "address of" one. It functions that way in an email address too.
- bsza 3y agoAlso, then "int @p" would read "integer at p" which is exactly what "int *p" means.
- robertlagrant 3y agoAh yes - that's true.
- amelius 3y agoSo address-of could be an "@" symbol, but upside down.
- anticensor 3y agoOr a spanish question mark ¿.
- frou_dh 3y agoThat's precisely what Clojure did, where @foo is syntactic sugar for (deref foo)
- jandrese 3y agoI agree, big missed opportunity in C’s development.
- jjgreen 3y agoInstance-variable heavy Ruby code does look rather like someone has sneezed on the monitor, so I think it would have been a bad move, aesthetically ...
- user3939382 3y agoNethack or code? You decide
- pjmlp 3y agoWhich is what Pascal dialects use.
- JoeAltmaier 3y agoYup. But as I understand it @ wasn't available on the terminals used to create C. Likewise #. They were used for later features, once they could actually be typed. Happy outcome, that there were characters available for fresh features, since C used absolutely everything available on the original (ADM?) terminals. Another curious thing: Unix came shortly after and was entirely typed with lower case. Because those same terminals had only one font (font ROMs were tiny back then, and expensive). It looked like UPPERCASE but in fact the keyboard produced lowercase. Once better terminals were used to edit the code it was noticed for the first time(?) that it's all be edited as lowercase. Or so the story went, back in those days, when it was all new.
- trealira 3y agoThat corroborates what I've read. The DEC PDP-11 assembler used the @ symbol for dereferences of registers ("@Rn" or "(Rn)" dereferenced a register, for example). However, in Unix, the terminal convention was to use the @ symbol to delete the current line, and they didn't have a DEC assembler yet, so they used the asterisk (*) instead in B, as well as in the Unix PDP-11 assembler, which was written in B. I'm paraphrasing this Quora post (which lists primary and secondary sources): https://www.quora.com/Why-did-the-developers-of-C-decide-to-use-an-asterisk-instead-of-the-much-more-intuitive-for-pointers https://www.quora.com/Why-did-the-developers-of-C-decide-to-...
- kps 3y ago1963 ASCII was upper-case only, and many early terminals (notably for Unix, including the Teletype 33) were upper case only. `stty lcase`, which maps upper-case input to lower case, existed early — https://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2/stty.2 https://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2/stty....
- aidenn0 3y agoAs far as I know @ on modern keyboards above the two from the IBM Selectric[1], released in 1961; the Model D and the VT-52 both copied the keyboard layout. The 1963 ASCII draft had @, despite not having lowercase yet. Prior to IBM, it was on at least the Underwood typewriters[2], so it was never quite absent. 1: https://en.wikipedia.org/wiki/IBM_Selectric#/media/File:IBM_Selectric_I_(4).jpg https://en.wikipedia.org/wiki/IBM_Selectric#/media/File:IBM_... Note that the number-row is only different from modern keyboards with the cent-sign being replaced with a caret (the cent-sign was never included in ASCII) 2: https://upload.wikimedia.org/wikipedia/commons/a/a4/Ernest_Hemingway_typewriter.jpg https://upload.wikimedia.org/wikipedia/commons/a/a4/Ernest_H...
- mock-possum 3y agoMy immediate thought as well. Where’s that value in memory? It’s @ the address.
- marssaxman 3y agoSome dialects of BASIC used @ as a shortcut for the `VarPtr` operation.