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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Name before type: why ‘age int’ is better than ‘int age’

3 点作者 benhoyt将近 2 年前

4 条评论

rowanG077将近 2 年前
Honestly I really don&#x27;t get people who are obsessed with this. Static vs dynamic? That matters A LOT! Error handling style? Very important. Expression based vs statement based? Now you are talking.<p>but whether a type is before or after the name of a variable? Come one man.,,
评论 #37035232 未加载
评论 #37027464 未加载
dchest将近 2 年前
Another example.<p>Jumpy Dart:<p><pre><code> (String, int) userInfo(Map&lt;String, dynamic&gt; json) int userAge(String name) </code></pre> Regular Swift:<p><pre><code> func userInfo(_ json: Dictionary&lt;String, Any&gt;) -&gt; (String, Int) func userAge(_ name: String) -&gt; Int</code></pre>
Someone将近 2 年前
FTA: “In C, the following declares x to be a pointer, but (surprisingly at first!) y to be a normal integer:<p><pre><code> int* x, y; </code></pre> Whereas the equivalent in Go does what you’d expect, declaring both to be pointers:<p><pre><code> var x, y *int</code></pre> ”*<p>I don’t see how that’s an argument in favour of <i>`age int`</i> over <i>`int age`</i>. Both C could easily have picked the alternative semantics. Go could have, too:<p><pre><code> var x*, y* int; &#x2F;&#x2F; two pointers var x, y* int; &#x2F;&#x2F; x is an int, y a pointer to int </code></pre> or<p><pre><code> var *x, *y int; &#x2F;&#x2F; two pointers var x, *y int; &#x2F;&#x2F; x is an int, y a pointer to int</code></pre>
Slashbot3将近 2 年前
type name ....is better, any other arrangement including adding stupid symbols like : ...is just retarded alot of retarded people around these days alot of them took the vax.. because they are retarded.