TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The origin and virtues of semicolons in programming languages

46 点作者 nalgeon大约 1 年前

8 条评论

adrian_b大约 1 年前
As this blog says, the semicolon has been introduced as the &quot;statement separator&quot; in December 1958, in the report about the language IAL (International Algebraic Language), which has been rebranded later, in 1960, as ALGOL.<p>The next important point in its history is in the language CPL (in its version described in January 1966), where the statement separator could be either the semicolon or the new line, whichever was convenient.<p>This feature of CPL has been inherited by the UNIX shell and by many other programming languages where the semicolon is used only for writing multiple statements on a single line.<p>While most such languages use some special character to mark continuation lines, to allow multiple-line statements, the CPL compiler was more clever and it decided automatically when a statement could not be terminated at the end of a line, so that the next line must have been a continuation line.
评论 #40044827 未加载
Koshkin大约 1 年前
Fun fact: in Greek, the semicolon is the question mark. (Actually, the regular question mark looks like an overturned and exaggerated semicolon.)
评论 #40046679 未加载
jacknews大约 1 年前
&quot;I&#x27;d love to hear what you would choose in your dream world!&quot;<p>Emphatically NOT significant-whitespace, which causes all kinds of headaches, for example in an education setting, with cut&amp;paste, etc.<p>Language structure should be denoted with actual characters, and then automatic formatting (pretty-printing) can confirm the structure is as intended; kind of like double-entry book-keeping.
mrbluecoat大约 1 年前
In the JavaScript world, tread cautiously on this passionate topic. <a href="https:&#x2F;&#x2F;github.com&#x2F;twbs&#x2F;bootstrap&#x2F;issues&#x2F;3057">https:&#x2F;&#x2F;github.com&#x2F;twbs&#x2F;bootstrap&#x2F;issues&#x2F;3057</a>
评论 #40045186 未加载
评论 #40045102 未加载
karmakaze大约 1 年前
When devising a custom keyboard layout, I had to decide whether semicolons were important or not in my future. I opted to put the comma on right-pinky above home row. The shifted-comma is still a colon though.
librasteve大约 1 年前
raku has a couple (extra) uses for the semi-colon…<p><pre><code> - statement line separator; - loop($i=0;$i++;$i&lt;3){…} * - multi dimensional subscripts @a[^3;^3;^3] - list of list literals (1,2; 3,4) eqv ((1,2), (3,4)); </code></pre> to paraphrase Larry Wall “everyone wants the [semi] colon”<p><a href="https:&#x2F;&#x2F;docs.raku.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.raku.org&#x2F;</a>
082349872349872大约 1 年前
Many are aware of ; in C but fewer of ,
评论 #40044050 未加载
评论 #40044284 未加载
teo_zero大约 1 年前
Let&#x27;s not forget that BASIC used the colon.
评论 #40046615 未加载