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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Strangest Programming Language Feature?

74 点作者 jackhammer2022超过 11 年前

24 条评论

Someone超过 11 年前
No mention of &quot;ALTER&quot; (<a href="http://en.wikipedia.org/wiki/COBOL#Self-modifying_code" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;COBOL#Self-modifying_code</a>) on the first page?<p>Self-modifying code was fairly common at the time COBOL was developed, but incorporating it in a high-level business language was, IMO, a very weird decision.<p>I also miss call by name (<a href="http://en.wikipedia.org/wiki/Man_or_boy_test" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Man_or_boy_test</a>) on the first page.<p>In general, one should read the Intercal (<a href="http://en.wikipedia.org/wiki/INTERCAL" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;INTERCAL</a>) paper, and figure out from which language each of its features came.
评论 #7160334 未加载
评论 #7161147 未加载
antirez超过 11 年前
Smalltalk&#x27;s &quot;become&quot; is a pretty interesting one... <a href="http://gbracha.blogspot.it/2009/07/miracle-of-become.html" rel="nofollow">http:&#x2F;&#x2F;gbracha.blogspot.it&#x2F;2009&#x2F;07&#x2F;miracle-of-become.html</a>
评论 #7160784 未加载
评论 #7160982 未加载
al2o3cr超过 11 年前
&#x2F;me drops the MUMPS reference manual on the table<p>That whole language is one long-running WTF.
评论 #7160177 未加载
评论 #7160891 未加载
jejones3141超过 11 年前
Someone&#x27;s already mentioned COBOL&#x27;s ALTER X TO PROCEED TO Y, so I&#x27;ll mention a programming language called COMAL. A friend with a C64 showed it to me, and it was very respectable for its time and the available resources; reminded me of BASIC09.<p>Apparently it was written by someone from Denmark, and there were commands to switch back and forth between English and Danish. I don&#x27;t remember whether it was just for error messages or for those and for the language keywords as well; I want to say the latter.
mck-超过 11 年前
In CoffeeScript I discovered the other day that:<p><pre><code> 0 &lt;= &quot;&quot; &lt;= 0 # True &quot;&quot; is 0 # False</code></pre>
评论 #7161375 未加载
评论 #7161564 未加载
BlackDeath3超过 11 年前
&gt;GOD is REAL, unless declared INTEGER.<p>I&#x27;m stealing the hell out of this.
kabdib超过 11 年前
: 2 3 ;<p>... redefines the constant 2 as 3. FORTH. Go figure :-)
评论 #7160862 未加载
评论 #7161572 未加载
评论 #7160608 未加载
评论 #7161578 未加载
spc476超过 11 年前
INRAC, the langauge RACTER (<a href="http://en.wikipedia.org/wiki/Racter" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Racter</a>) has the most bizarre flow control I&#x27;ve ever seen in any computer language, ever. It can best be described as &quot;a random, pattern matched GOTO&#x2F;GOSUB&quot; which is the most succinct description I can come up with.<p>I have a blog entry about it (<a href="http://boston.conman.org/2008/06/18.2" rel="nofollow">http:&#x2F;&#x2F;boston.conman.org&#x2F;2008&#x2F;06&#x2F;18.2</a>) but in short, each line of an INRAC program (unless it ends with a &#x27;#&#x27; mark in which case execution continues to the next line) is a subroutine, each with a label. The label does not need be unique, but when you &quot;call&quot; a subroutine, INRAC will just pick one line with that label at random to execute. The pattern matching comes in because you can select the label with wildcard characters (which just picks a line that matches the pattern at random).<p>There isn&#x27;t much about the language on the Internet. In fact, the <i>only</i> other page aside from my blog entry (which I wrote as I went through the existing source code I found for Racter) is the Racter FAQ (<a href="https://groups.google.com/forum/#!topic/rec.arts.int-fiction/RTV5CUkJ8fs" rel="nofollow">https:&#x2F;&#x2F;groups.google.com&#x2F;forum&#x2F;#!topic&#x2F;rec.arts.int-fiction...</a>) which has a few inaccuracies (or perhaps was looking at a version of the code before processing).
zokier超过 11 年前
C++ has all sorts of fun stuff. One example is std::vector&lt;bool&gt;, which is not implemented as a simple array of booleans like every other std::vector, but instead it is a bitmap. Afaik this behavior is required by standard. One fun side-effect is that you can&#x27;t take the address of individual elements of the vector.<p>Compare these two:<p><a href="http://ideone.com/qC9yOp" rel="nofollow">http:&#x2F;&#x2F;ideone.com&#x2F;qC9yOp</a><p><a href="http://ideone.com/jF4krp" rel="nofollow">http:&#x2F;&#x2F;ideone.com&#x2F;jF4krp</a>
protomyth超过 11 年前
The control structures in Icon are not quite what you would expect and qualify as strange: <a href="http://en.wikipedia.org/wiki/Icon_(programming_language)" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Icon_(programming_language)</a>
评论 #7161099 未加载
eli_gottlieb超过 11 年前
I&#x27;m the only person thinking of the way MATLAB passes everything by value, including compound objects and structs?
julian_t超过 11 年前
Snobol... where patterns are first class constructs, and every line can end with a GOTO. That definitely lets you write some very, er, compact code. But it was superb to program in.<p>And how about the assigned GOTO in older versions of Fortran? &quot;GOTO N&quot; where N is an integer variable whose value will be known at runtime.<p>Happy days...
评论 #7162282 未加载
adamnemecek超过 11 年前
Fun fact, this is also the reason why &#x27;i&#x27; is commonly used as a name for the loop counter variable.
评论 #7160658 未加载
评论 #7160303 未加载
评论 #7160288 未加载
cratermoon超过 11 年前
The COBOL MOVE-CORRESPONDING verb. I&#x27;m not going to try to explain exactly how it works here, but imagine, if you will, copying the contents of one table to another table with a different column structure, but sort of the same names.
评论 #7160491 未加载
Pxtl超过 11 年前
C switch fallthrough. I know it&#x27;s old and everybody&#x27;s used to it and I get why it&#x27;s there, but it&#x27;s freaking weird. I love c#&#x27;s response that you must use goto &lt;case&gt; instead to make fallthrough explicit.
dj-wonk超过 11 年前
I <i>heart</i> what should be called a &quot;truth injection attack&quot; in Python: <a href="http://stackoverflow.com/a/2021553/109618" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;2021553&#x2F;109618</a>
评论 #7161362 未加载
eps超过 11 年前
Duff&#x27;s device is certainly a very strange construct.<p><a href="http://www.lysator.liu.se/c/duffs-device.html#duffs-device" rel="nofollow">http:&#x2F;&#x2F;www.lysator.liu.se&#x2F;c&#x2F;duffs-device.html#duffs-device</a>
kyberias超过 11 年前
This question is a beautiful invitation for everyone to defend their favorite languages! :)
Pxtl超过 11 年前
in vb.net: off-by-one array sizes so people who do one-based arrays don&#x27;t get hurt. Also, two sets of boolean operators, the simpler ones don&#x27;t short-circuit (or vs orelse, and vs andalso).
analog31超过 11 年前
Line numbers in BASIC
评论 #7160917 未加载
评论 #7161747 未加载
评论 #7161748 未加载
Thiz超过 11 年前
For…else in python.<p>Weird. or dutch.
评论 #7160803 未加载
runn1ng超过 11 年前
&quot;not really a question. closed.&quot;
评论 #7161941 未加载
Crito超过 11 年前
It logically follows from how arrays in C works, so I don&#x27;t really know if it qualifies for weird&#x2F;suprising, but the old <i>array[i]</i> &#x2F; <i>i[array]</i> thing is fun to show to people who haven&#x27;t seen it before.<p>The most amusingly weird thing I can think of is INTERCAL&#x27;s COMEFROM: <a href="http://en.wikipedia.org/wiki/COMEFROM" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;COMEFROM</a>
评论 #7160620 未加载
Fasebook超过 11 年前
Javascript&#x27;s DOM