Why is the syntax of some programming languages very much not according to earlier conventions? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What are the definitions of syntax and semantics?what would be the drawbacks of lecturing two programming languages simultaneously?Terminology - the reason for symbol reuse in programming languagesHow did it happen that Algol 60 was an improvement on its successors?Why are strings immutable in some languages?Why are these features missing in modern day general purpose computer languages?Why does the following Backus-Naur form reflect the following syntax diagram?Languages with Multiple Arbitrary Return ValuesWhy are some programming languages “faster” or “slower” than others?Why in Declarative Programming variables are not reassigned?

Can gravitational waves pass through a black hole?

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

Why can't fire hurt Daenerys but it did to Jon Snow in season 1?

Maximum rotation made by a symmetric positive definite matrix?

By what mechanism was the 2017 UK General Election called?

Restricting the Object Type for the get method in java HashMap

Is it OK if I do not take the receipt in Germany?

Is honorific speech ever used in the first person?

Is there night in Alpha Complex?

Vertical ranges of Column Plots in 12

Why is there so little support for joining EFTA in the British parliament?

How to name indistinguishable henchmen in a screenplay?

How to get a flat-head nail out of a piece of wood?

などの followed by a Noun

Is the Mordenkainen's Sword spell underpowered?

Should man-made satellites feature an intelligent inverted "cow catcher"?

Any stored/leased 737s that could substitute for grounded MAXs?

Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?

Why not use the yoke to control yaw, as well as pitch and roll?

Can one Knight really make another one a Knight?

An isoperimetric-type inequality inside a cube

How to resize main filesystem

How many time has Arya actually used Needle?

Keep at all times, the minus sign above aligned with minus sign below



Why is the syntax of some programming languages very much not according to earlier conventions?



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?What are the definitions of syntax and semantics?what would be the drawbacks of lecturing two programming languages simultaneously?Terminology - the reason for symbol reuse in programming languagesHow did it happen that Algol 60 was an improvement on its successors?Why are strings immutable in some languages?Why are these features missing in modern day general purpose computer languages?Why does the following Backus-Naur form reflect the following syntax diagram?Languages with Multiple Arbitrary Return ValuesWhy are some programming languages “faster” or “slower” than others?Why in Declarative Programming variables are not reassigned?










1












$begingroup$


Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages and so have natural languages and all of their symbols. Still, instead of respecting these conventions fully, designers of languages such as C have gone against them, for example by using the very old &, used in logic and natural language to denote conjunction, for something totally different, or by using the well-known = and == in unexpected ways, or by using ! for negation. Why?



Even if there were constraints to work with, certainly a programming language designer and implementor could make the syntax much more readable, less cryptic, and still concise and more natural, respecting established conventions? After all, there have been examples of that (Wirthian programming languages). And they can certainly do it these days.



Furthermore, certainly subjects such as philosophy, logic, mathematics and natural languages are very much primary and very essential subjects without which there would not even exist any computer science and no programming language. The symbols there used are very much known by many or they are at least standard. Why then go against established principles?










share|cite|improve this question









$endgroup$











  • $begingroup$
    This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
    $endgroup$
    – D.W.
    13 hours ago










  • $begingroup$
    Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
    $endgroup$
    – user101144
    13 hours ago










  • $begingroup$
    Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
    $endgroup$
    – D.W.
    13 hours ago







  • 1




    $begingroup$
    Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
    $endgroup$
    – D.W.
    13 hours ago











  • $begingroup$
    That's a question about the design of C.
    $endgroup$
    – Yuval Filmus
    10 hours ago















1












$begingroup$


Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages and so have natural languages and all of their symbols. Still, instead of respecting these conventions fully, designers of languages such as C have gone against them, for example by using the very old &, used in logic and natural language to denote conjunction, for something totally different, or by using the well-known = and == in unexpected ways, or by using ! for negation. Why?



Even if there were constraints to work with, certainly a programming language designer and implementor could make the syntax much more readable, less cryptic, and still concise and more natural, respecting established conventions? After all, there have been examples of that (Wirthian programming languages). And they can certainly do it these days.



Furthermore, certainly subjects such as philosophy, logic, mathematics and natural languages are very much primary and very essential subjects without which there would not even exist any computer science and no programming language. The symbols there used are very much known by many or they are at least standard. Why then go against established principles?










share|cite|improve this question









$endgroup$











  • $begingroup$
    This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
    $endgroup$
    – D.W.
    13 hours ago










  • $begingroup$
    Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
    $endgroup$
    – user101144
    13 hours ago










  • $begingroup$
    Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
    $endgroup$
    – D.W.
    13 hours ago







  • 1




    $begingroup$
    Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
    $endgroup$
    – D.W.
    13 hours ago











  • $begingroup$
    That's a question about the design of C.
    $endgroup$
    – Yuval Filmus
    10 hours ago













1












1








1





$begingroup$


Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages and so have natural languages and all of their symbols. Still, instead of respecting these conventions fully, designers of languages such as C have gone against them, for example by using the very old &, used in logic and natural language to denote conjunction, for something totally different, or by using the well-known = and == in unexpected ways, or by using ! for negation. Why?



Even if there were constraints to work with, certainly a programming language designer and implementor could make the syntax much more readable, less cryptic, and still concise and more natural, respecting established conventions? After all, there have been examples of that (Wirthian programming languages). And they can certainly do it these days.



Furthermore, certainly subjects such as philosophy, logic, mathematics and natural languages are very much primary and very essential subjects without which there would not even exist any computer science and no programming language. The symbols there used are very much known by many or they are at least standard. Why then go against established principles?










share|cite|improve this question









$endgroup$




Looking at the syntax of the programming language C and others inspired by it, I cannot help but ask the question in the title. Mathematics, logic and other subjects have been existing for many ages and so have natural languages and all of their symbols. Still, instead of respecting these conventions fully, designers of languages such as C have gone against them, for example by using the very old &, used in logic and natural language to denote conjunction, for something totally different, or by using the well-known = and == in unexpected ways, or by using ! for negation. Why?



Even if there were constraints to work with, certainly a programming language designer and implementor could make the syntax much more readable, less cryptic, and still concise and more natural, respecting established conventions? After all, there have been examples of that (Wirthian programming languages). And they can certainly do it these days.



Furthermore, certainly subjects such as philosophy, logic, mathematics and natural languages are very much primary and very essential subjects without which there would not even exist any computer science and no programming language. The symbols there used are very much known by many or they are at least standard. Why then go against established principles?







programming-languages language-design syntax






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked 14 hours ago









user101144user101144

192




192











  • $begingroup$
    This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
    $endgroup$
    – D.W.
    13 hours ago










  • $begingroup$
    Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
    $endgroup$
    – user101144
    13 hours ago










  • $begingroup$
    Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
    $endgroup$
    – D.W.
    13 hours ago







  • 1




    $begingroup$
    Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
    $endgroup$
    – D.W.
    13 hours ago











  • $begingroup$
    That's a question about the design of C.
    $endgroup$
    – Yuval Filmus
    10 hours ago
















  • $begingroup$
    This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
    $endgroup$
    – D.W.
    13 hours ago










  • $begingroup$
    Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
    $endgroup$
    – user101144
    13 hours ago










  • $begingroup$
    Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
    $endgroup$
    – D.W.
    13 hours ago







  • 1




    $begingroup$
    Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
    $endgroup$
    – D.W.
    13 hours ago











  • $begingroup$
    That's a question about the design of C.
    $endgroup$
    – Yuval Filmus
    10 hours ago















$begingroup$
This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
$endgroup$
– D.W.
13 hours ago




$begingroup$
This sounds awfully broad. If you have a specific convention in mind and a specific aspect of C syntax, you could ask why that aspect of C syntax is the way it is and not some other way; that sounds answerable. But your current question seems too vague and broad to be answerable, as it's not clear what aspect of C syntax you are thinking of nor which mathematical convention you are thinking of.
$endgroup$
– D.W.
13 hours ago












$begingroup$
Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
$endgroup$
– user101144
13 hours ago




$begingroup$
Of course it is answerable. (And I did mention a few C-like examples and the like.) All you have to do is read it, understand it, and answer it. I don't see how it is vague: the words and their meaning are pretty clear. Broad, if it even is, is not equal to vague, if you meant that.
$endgroup$
– user101144
13 hours ago












$begingroup$
Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
$endgroup$
– D.W.
13 hours ago





$begingroup$
Our site is designed for narrowly scoped technical questions that can be answered in a paragraph or two; where answers can be supported by evidence or facts, not mere opinion; where we don't have to guess what you might have in mind; and where the criteria for evaluating are clear to others who want to vote on answers. I don't know if you realize this, but questions that are too broad are often closed, as they tend not to work well on our site format (see e.g., cs.stackexchange.com/help/closed-questions). I encourage you to edit your question to narrow it down as I suggested.
$endgroup$
– D.W.
13 hours ago





1




1




$begingroup$
Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
$endgroup$
– D.W.
13 hours ago





$begingroup$
Right now you're effectively asking many questions; one for each part of C syntax that differs from mathematical notation. The answer for each might be different, which is part of why this kind of question doesn't work well on our site format. To provide a complete answer, one would need a compendium of all those differences and the reasons for each one, which is too much to expect from a single answer. Worse, we have to infer what those questions are, because you haven't listed specifically which parts of C syntax you're especially interested in.
$endgroup$
– D.W.
13 hours ago













$begingroup$
That's a question about the design of C.
$endgroup$
– Yuval Filmus
10 hours ago




$begingroup$
That's a question about the design of C.
$endgroup$
– Yuval Filmus
10 hours ago










1 Answer
1






active

oldest

votes


















6












$begingroup$

Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.



A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces to delimit code blocks, semicolons ; to delimit instructions, dot . to access an element of a compound structure by name, the equal sign = as the assignment operator, double-equal == as the equality operator and != as inequality, && and || as logical-and and logical-or, square brackets […] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments function(argument1, argument2, …).



The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.



Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.



The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.



An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $wedge$, $vee$ and $neg$. FORTRAN and ALGOL 58 spelled them out AND, OR and NOT. C (following some of its ancestors) used &&, || and !. Mathematicians never used & for conjunction, as far as I know¹: that came from Latin (& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including / and /, which contributed to the imposition of the backslash as a standard character.



Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is (function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).



A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $leftarrow$, $rightarrow$, $neq$, $neg$, $subset$, $supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.



Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been . following the typography of most languages, but that character was also used in mathematics for decimal numbers. ;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol = was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses = for assignment and == for equality testing. Other languages made different choices. ALGOL used the arguably more fitting := for assignment (more fitting because it's asymmetric, leaving the symmetric symbol = free for the symmetric concept of equality). PL/1 uses = for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like set x = … or let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing = for assignment.



¹ Linear logic uses $&$ but that's not the ordinary conjunction and that came later.






share|cite|improve this answer









$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "419"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f107327%2fwhy-is-the-syntax-of-some-programming-languages-very-much-not-according-to-earli%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6












    $begingroup$

    Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.



    A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces to delimit code blocks, semicolons ; to delimit instructions, dot . to access an element of a compound structure by name, the equal sign = as the assignment operator, double-equal == as the equality operator and != as inequality, && and || as logical-and and logical-or, square brackets […] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments function(argument1, argument2, …).



    The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.



    Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.



    The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.



    An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $wedge$, $vee$ and $neg$. FORTRAN and ALGOL 58 spelled them out AND, OR and NOT. C (following some of its ancestors) used &&, || and !. Mathematicians never used & for conjunction, as far as I know¹: that came from Latin (& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including / and /, which contributed to the imposition of the backslash as a standard character.



    Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is (function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).



    A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $leftarrow$, $rightarrow$, $neq$, $neg$, $subset$, $supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.



    Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been . following the typography of most languages, but that character was also used in mathematics for decimal numbers. ;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol = was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses = for assignment and == for equality testing. Other languages made different choices. ALGOL used the arguably more fitting := for assignment (more fitting because it's asymmetric, leaving the symmetric symbol = free for the symmetric concept of equality). PL/1 uses = for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like set x = … or let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing = for assignment.



    ¹ Linear logic uses $&$ but that's not the ordinary conjunction and that came later.






    share|cite|improve this answer









    $endgroup$

















      6












      $begingroup$

      Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.



      A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces to delimit code blocks, semicolons ; to delimit instructions, dot . to access an element of a compound structure by name, the equal sign = as the assignment operator, double-equal == as the equality operator and != as inequality, && and || as logical-and and logical-or, square brackets […] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments function(argument1, argument2, …).



      The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.



      Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.



      The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.



      An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $wedge$, $vee$ and $neg$. FORTRAN and ALGOL 58 spelled them out AND, OR and NOT. C (following some of its ancestors) used &&, || and !. Mathematicians never used & for conjunction, as far as I know¹: that came from Latin (& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including / and /, which contributed to the imposition of the backslash as a standard character.



      Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is (function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).



      A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $leftarrow$, $rightarrow$, $neq$, $neg$, $subset$, $supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.



      Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been . following the typography of most languages, but that character was also used in mathematics for decimal numbers. ;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol = was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses = for assignment and == for equality testing. Other languages made different choices. ALGOL used the arguably more fitting := for assignment (more fitting because it's asymmetric, leaving the symmetric symbol = free for the symmetric concept of equality). PL/1 uses = for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like set x = … or let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing = for assignment.



      ¹ Linear logic uses $&$ but that's not the ordinary conjunction and that came later.






      share|cite|improve this answer









      $endgroup$















        6












        6








        6





        $begingroup$

        Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.



        A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces to delimit code blocks, semicolons ; to delimit instructions, dot . to access an element of a compound structure by name, the equal sign = as the assignment operator, double-equal == as the equality operator and != as inequality, && and || as logical-and and logical-or, square brackets […] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments function(argument1, argument2, …).



        The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.



        Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.



        The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.



        An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $wedge$, $vee$ and $neg$. FORTRAN and ALGOL 58 spelled them out AND, OR and NOT. C (following some of its ancestors) used &&, || and !. Mathematicians never used & for conjunction, as far as I know¹: that came from Latin (& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including / and /, which contributed to the imposition of the backslash as a standard character.



        Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is (function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).



        A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $leftarrow$, $rightarrow$, $neq$, $neg$, $subset$, $supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.



        Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been . following the typography of most languages, but that character was also used in mathematics for decimal numbers. ;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol = was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses = for assignment and == for equality testing. Other languages made different choices. ALGOL used the arguably more fitting := for assignment (more fitting because it's asymmetric, leaving the symmetric symbol = free for the symmetric concept of equality). PL/1 uses = for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like set x = … or let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing = for assignment.



        ¹ Linear logic uses $&$ but that's not the ordinary conjunction and that came later.






        share|cite|improve this answer









        $endgroup$



        Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.



        A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces to delimit code blocks, semicolons ; to delimit instructions, dot . to access an element of a compound structure by name, the equal sign = as the assignment operator, double-equal == as the equality operator and != as inequality, && and || as logical-and and logical-or, square brackets […] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments function(argument1, argument2, …).



        The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.



        Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.



        The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.



        An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $wedge$, $vee$ and $neg$. FORTRAN and ALGOL 58 spelled them out AND, OR and NOT. C (following some of its ancestors) used &&, || and !. Mathematicians never used & for conjunction, as far as I know¹: that came from Latin (& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including / and /, which contributed to the imposition of the backslash as a standard character.



        Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is (function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).



        A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $leftarrow$, $rightarrow$, $neq$, $neg$, $subset$, $supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.



        Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been . following the typography of most languages, but that character was also used in mathematics for decimal numbers. ;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol = was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses = for assignment and == for equality testing. Other languages made different choices. ALGOL used the arguably more fitting := for assignment (more fitting because it's asymmetric, leaving the symmetric symbol = free for the symmetric concept of equality). PL/1 uses = for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like set x = … or let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing = for assignment.



        ¹ Linear logic uses $&$ but that's not the ordinary conjunction and that came later.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered 9 hours ago









        GillesGilles

        33.7k797164




        33.7k797164



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Computer Science Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f107327%2fwhy-is-the-syntax-of-some-programming-languages-very-much-not-according-to-earli%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

            Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

            Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar