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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Finding and fixing standard misconceptions about program behavior

77 点作者 vector_spaces大约 1 年前

5 条评论

Animats大约 1 年前
&gt; We also believe that the terms “call-by-value” and “call-by-reference” are so hopelessly muddled at this point (between students, instructors, blogs, the Web…) that finding better terminology overall would be helpful.<p>Maybe that shouldn&#x27;t even be exposed to the programmer. The programmer-level questions are, is it copyable, is it mutable, and is it alias-free? Whether it&#x27;s passed as a copy or a pointer is really an issue for the compiler. If you&#x27;re passed a read-only copy of something guaranteed to not be aliased, you can&#x27;t tell the difference from a reference. Some Modula compilers made that decision automatically, based on object size.<p>Rust compilers have the info to do this. I&#x27;m sometimes asking myself whether I should pass, say, an array of 3 32-bit floats in graphics code by reference or by value. The compiler knows better than the programmer what the hardware can copy fast, and that may differ with the platform.
评论 #40026973 未加载
评论 #40030989 未加载
评论 #40028902 未加载
评论 #40028467 未加载
评论 #40026716 未加载
justin_oaks大约 1 年前
This is great. It&#x27;s good to see someone attempting to identify a mistaken mental model and then correcting it.<p>In both formal and informal education, it is rare to see teachers&#x2F;parents&#x2F;mentors identifying misunderstandings and correcting them. All too often the one teaching reiterates the lesson material instead of asking the learner about their understanding and correcting misunderstandings.
评论 #40025074 未加载
echoangle大约 1 年前
I get that the syntax options are just to adapt to different language users but it’s a little bit confusing that some claims are actually wrong in the specific language. In the first test, they state that adding two bools gives an error, even though this is perfectly valid in Python.
Turing_Machine大约 1 年前
Nice, but needs some more attention to variant (but equivalent) responses.<p>For example, for one of the questions in the first module I selected &quot;Other&quot;, then typed &quot;Error&quot; (in the free-form response box). The answer it was looking for was &quot;error&quot; (lower-case e).<p>Either it should accept both, or if you&#x27;re really insistent on distinguishing the two, it should be made more clear at the beginning that system messages (rather than explicit results) are going to be case-sensitive. Counting &quot;ABC&quot; wrong when the expected answer is &quot;abc&quot; would be fair game. Counting &quot;Error&quot; wrong for a pseudo-language that hasn&#x27;t even been formally defined is not, or so I see it.<p>Looking at some of the languages on which this is claims to be based:<p>In JavaScript, typing abc when it&#x27;s undefined produces: Uncaught ReferenceError: abc is not defined at &lt;anonymous&gt;:1:1 (anonymous) @ VM33:1<p>(note capital E in ReferenceError)<p>In Python3 you get:<p>NameError: name &#x27;abc&#x27; is not defined. Did you mean: &#x27;abs&#x27;?<p>(again, note capital E in NameError)<p>In Racket 8.9 you get:<p>abc: undefined; cannot reference an identifier before its definition<p>(no &#x27;error&#x27; of any kind!)<p>I didn&#x27;t install OCaml, because I need another &quot;package manager&quot; like I need a hole in the head.<p>Java: does not compile, although to be fair the compiler error message does have an &#x27;error with lower-case e&#x27; in it.<p>C#: Yeah, not gonna install that either.<p>This may seem extremely nit-picky (and it is), but when you&#x27;re teaching people who&#x27;ve never programmed before, and who may have never even encountered the concept of case sensitivity before (&quot;But Google doesn&#x27;t care even if I type in all caps!&quot;), nit-picky is the way it needs to be.<p>As I said, I do like this, but it needs more attention paid to parsing free-form responses. The problem is not unique to this system, of course. The free-form response is where most systems of this general type tend to fail.
评论 #40033556 未加载
评论 #40026536 未加载
acbart大约 1 年前
Oooh, this is awesome. I love the formalizationd presented here, and the formalization of a notional machine into something more powerful and executable. Can&#x27;t wait to hear more about this. Great name too! SMoL!